struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20020213-1.c
blobca3194a623c728c910903169679570df2ca7d382
1 /*
2 20020213-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #pragma disable_warning 85
13 /* PR c/5681
14 This testcase failed on IA-32 at -O0, because safe_from_p
15 incorrectly assumed it is safe to first write into a.a2 b-1
16 and then read the original value from it. */
18 int bar (float);
20 struct A {
21 float a1;
22 int a2;
23 } a;
25 int b;
27 void foo (void)
29 a.a2 = bar (a.a1);
30 a.a2 = a.a2 < b - 1 ? a.a2 : b - 1;
31 if (a.a2 >= b - 1)
32 ASSERT (0);
35 int bar (float x)
37 return 2241;
40 void
41 testTortureExecute (void)
43 a.a1 = 1.0f;
44 b = 3384;
45 foo ();