Error when porting from intel compiler to PGI compiler

I am trying a demo version of the PGI compiler (vers5.2-1 on RedHat 7.2). The code I have to compile works perfectly using gcc or icc. With pgcc, I have got several errors:

  1. PGC-S-0103-Illegal operand types for comparison operator
    For example:
#include <stdio.h>

int main(){
	char c1;
	if( c1 == NULL ) printf ("hello");
	return 1;

It may not be regular ANSI C code, but still, it is widely accepted. I could fix that by changing the PGI stddef.h file, replacing #define NULL ((void *)0 by #define NULL 0.

  1. PGC-F-0000-Internal compiler error. Macro recursion stack size exceeded
    It happen for several functions of my program. Do you know a way to fix that ?

The header files we have included have been only slightly modifed from the existing system include files. Looking at the stddef.h file, found on our RedHat 7.2 system in /usr/include/linux, I see that NULL is defined as “(void *) 0”. Basically, we choose to accept the system’s definition of NULL. As you pointed out, you can simply re-define NULL to suit your needs or you could cast the NULL to a char.

As for the ICE, could you send a more detailed description of the problem to From the error message it sounds like we’re doing an infinite recursive macro expansion and might be a compiler bug.