fix for execute/991221-1.c -O1 failure

Joern Rennecke amylaar@cygnus.co.uk
Thu Dec 30 12:55:00 GMT 1999


Here is the pointerized version of 991221.c .
I know this is not standard C, but I suppose gcc should be able to handle
this.  N.B. it works with -O0 but fails when optimizing.

gcc itself uses -1 as a special 'pointer' value in some places.

int main( void )
{
   char *totalsize = (char *)80;
   char *msize = (char *)64;

   if (sizeof(char *) != 4)
     exit(0);
   
   if ( totalsize > (char *)(2147483647L   * 2UL + 1)  
        || (msize != 0 && ((msize - 1) > (char *)(2147483647L   * 2UL + 1) )))
      abort();
   exit( 0 );
}


More information about the Gcc mailing list