drd/tests/swapcontext: Improve the portability of this test further
[valgrind.git] / none / tests / x86 / fpu_lazy_eflags.c
blobe308bc058ee10679ec152a1a5cb2dc25950faf71
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@aig.jpl.nasa.gov for the test case and the
4 following information:
6 Anyway, the error only occurs if you compile it with the options:
8 gcc -O2 -mcpu=pentiumpro -march=pentiumpro
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.
13 The correct output of the program is "0.000000". When run under valgrind
14 1.9.4, it outputs "1.000000".
17 #include <stdio.h>
19 int main(int argc, char **argv)
21 union {
22 float a[2];
23 int b[2];
24 } u;
26 u.a[0] = 0.0 / 0.0;
27 u.a[1] = ((*u.b & 0x7FC00000) != 0x7FC00000);
28 printf("%f\n", u.a[1]);
30 return 0;