Null pointer check elimination

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Sir,
I am working with gcc 4.1.2 compiler in x86 system running Linux OS.
 
The following code snippet is taken from the link 'Global Null pointer test elimination', which appears in GCC-3.0 new features webpage.

foo (char *x)
{
  char ret = *x;

  if (x)
    com();
  else
    bar();
  return ret;
}

It is expected that the compiler will eliminate the pointer check with the option '-fdelete-null-pointer-checks' or with the option -O2, -O3, or -Os.

The expected assembly files with and without using the âfdelete-null-pointer-check has been provided in the same link. But while observing the compiler generated assembly, it is evident that the compiler is not eliminating the null-pointer check. 
Please advice.
Thanks & Regards,
Sankar







[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux