struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20021204-1.c
blob795befc4bd06167b68e553f37450b08781118f6e
1 /*
2 20021204-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #pragma disable_warning 196
10 #endif
12 /* This test was miscompiled when using sibling call optimization,
13 because X ? Y : Y - 1 optimization changed X into !X in place
14 and haven't reverted it if do_store_flag was successful, so
15 when expanding the expression the second time it was
16 !X ? Y : Y - 1. */
18 void foo (int x)
20 if (x != 1)
21 ASSERT (0);
24 int z;
26 void testTortureExecute (void)
28 char *a = "test";
29 char *b = a + 2;
31 foo (z > 0 ? b - a : b - a - 1);
32 return;