Here is a short C++ code that will compile and run using PGI 7.2-5 and earlier but not with 9.0-x and the latest 10.x on a RHEL 4.3 system:
#include
int main()
{
std::cout << “Hello, world!” << std::endl;
return 0;
}
Nothing complicated about it. If the -A flag is given to pgCC compilation will abort with the following errors for the newer compilers:
$ pgCC -A hello.cc
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
“/usr/lib/gcc/x86_64-redhat-linux/3.4.5/include/stddef.h”, line 418: error:
incompatible redefinition of macro “offsetof” (declared at line 25
of “/opt/PGI/pgi_9.0-3/linux86-64/9.0-3/include/stddef.h”)
#define offsetof(TYPE, MEMBER)
^
9 errors detected in the compilation of “hello.cc”.
Now, under PGI 7.2-5, the pgi-included stddef.h file contains only the following:
#include_next <stddef.h>
whereas for the latest PGIs you first undef and then redefine the offsetof macro. This seems to work until the -A flag is added, then you get the errors above.
Any idea what is going on? I suspect that adding -A (or -strict) is trying to tell us that we’re doing something non-standard; however, the error about an incompatible redef is confusing.
-david