2015年4月28日 星期二

gcc 4.9 default open -fdelete-null-pointer-checks


#include
int foo(int *a, int size){

memset (a, 0, size);
if (a != NULL)
   return 1;
else
   return 0;
}



this function always return 1

gcc 4.9 default opens -fdelete-null-pointer-checks
but memset's first funtion parameters is "nonull attribute", so else section will be removed

沒有留言:

張貼留言