PGI 18.4: undefined reference to `__builtin_constant_p`

Dear all,

when compiling and linking the following code I get the aforementioned link error:

$ pgcc --version

pgcc 18.4-0 64-bit target on x86-64 Linux -tp haswell 
PGI Compilers and Tools
Copyright (c) 2018, NVIDIA CORPORATION.  All rights reserved.
$ cat >swab.c <<EOC
#include <linux/swab.h>

int main(int i, char *a[]) {
    return __swab32(42u);
$ pgcc swab.c
/tmp/pgccG7xgGx-Pb9r0.o: In function `main':
/home/wesarg/tmp/pgi.PHHQ/./swab.c:4: undefined reference to `__builtin_constant_p'

This happens with the LLVM variant too. This happens on a recent Ubuntu installation with GCC 7. I can provide the result of preprocessing, if requested.

My workaround is to add this line to the _c_macros.h:

#define __builtin_constant_p(x) (0)

Sorry, someone ate the ‘#’ in the ‘#include’ statement

Any comments?

What version of OS are you running? Might be useful to post your localrc file from the compiler bin directory.

This is observable on Ubuntu 18.04 (kernel 4.18) and 16.04 (kernel 4.4) x86-64. And it still happens with PGI 18.10.

Hi Bert,

It looks like we don’t support __builtin_constant_p yet. It would seem that any macro that relies on this builtin will fail when it is expanded out. I opened TPR#26861 to address it.