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

留言

這個網誌中的熱門文章

我們能利用machine learning去幫助compiler的optimization演算法變強嗎?

The Speed Game: Automated Trading Systems in C++

被討厭的勇氣 自我啟發之父阿德勒的教導