1 /* This test case is for a FPU bug to do with lazy eflags updating that was 2 fixed by commit 1.42 in coregrind/vg_from_ucode.c in the HEAD. Thanks to 3 Dominic Mazzoni <dmazzoni (at) aig.jpl.nasa.gov for the test case and the 4 following information: 5 6 Anyway, the error only occurs if you compile it with the options: 7 8 gcc -O2 -mcpu=pentiumpro -march=pentiumpro 9 10 However, the exact same error occurs whether I compile the program with 11 gcc 2.96 (RedHat 7.3's version) or gcc 3.2. 12 13 The correct output of the program is "0.000000". When run under valgrind 14 1.9.4, it outputs "1.000000". 15 */ 16 17 #include <stdio.h> 18 19 int main(int argc, char **argv) 20 { 21 union { 22 float a[2]; 23 int b[2]; 24 } u; 25 26 u.a[0] = 0.0 / 0.0; 27 u.a[1] = ((*u.b & 0x7FC00000) != 0x7FC00000); 28 printf("%f\n", u.a[1]); 29 30 return 0; 31 } 32 33