struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr61673.c
blob2bf2374befdf875614de35ce8e93867d40d069f6
1 /*
2 pr61637.c from the execute part of the gcc torture tests.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 /* PR rtl-optimization/61673 */
13 char e;
15 void
16 bar (char x)
18 if (x != 0x54 && x != (char) 0x87)
19 ASSERT (0);
22 void
23 foo (const char *x)
25 char d = x[0];
26 int c = d;
27 if ((c >= 0 && c <= 0x7f) == 0)
28 e = d;
29 bar (d);
32 void
33 baz (const char *x)
35 char d = x[0];
36 int c = d;
37 if ((c >= 0 && c <= 0x7f) == 0)
38 e = d;
41 void
42 testTortureExecute (void)
44 const char c[] = { 0x54, 0x87 };
45 e = 0x21;
46 foo (c);
47 if (e != 0x21)
48 ASSERT (0);
49 foo (c + 1);
50 if (e != (char) 0x87)
51 ASSERT (0);
52 e = 0x21;
53 baz (c);
54 if (e != 0x21)
55 ASSERT (0);
56 baz (c + 1);
57 if (e != (char) 0x87)
58 ASSERT (0);