次のコードをテストします。
#include <stdio.h>
#include <stdlib.h>
main()
{
const char *yytext="0";
const float f=(float)atof(yytext);
size_t t = *((size_t*)&f);
printf("t should be 0 but is %d\n", t);
}
次のようにコンパイルします。
gcc -O3 test.c
GOOD 出力は次のようになります。
"t should be 0 but is 0"
しかし、私のgcc 4.1.3では、次のものがあります。
"t should be 0 but is -1209357172"