struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr47337.c
blob06ca74a754731b656003be3357db254e7ae060db
1 /*
2 pr47337.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 #include <string.h>
13 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pic14) && !defined(__SDCC_pic16) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
15 /* PR rtl-optimization/47337 */
17 static unsigned int a[256], b = 0;
18 static char c = 0;
19 static int d = 0, *f = &d;
20 static long long e = 0;
22 static short
23 foo (long long x, long long y)
25 return x / y;
28 static char
29 bar (char x, char y)
31 return x - y;
34 static int
35 baz (int x, int y)
37 *f = (y != (short) (y * 3));
38 for (c = 0; c < 2; c++)
40 lab:
41 if (d)
43 if (e)
44 e = 1;
45 else
46 return x;
48 else
50 d = 1;
51 goto lab;
53 f = &d;
55 return x;
58 static void
59 fnx (unsigned long long x, int y)
61 if (!y)
63 b = a[b & 1];
64 b = a[b & 1];
65 b = a[(b ^ (x & 1)) & 1];
66 b = a[(b ^ (x & 1)) & 1];
70 const char *volatile w = "2";
71 #endif
73 void
74 testTortureExecute (void)
76 #if !defined(__SDCC_mcs51) && !defined(__SDCC_pic14) && !defined(__SDCC_pic16) && !defined(__SDCC_pdk14) && !defined(__SDCC_pdk15) // Lack of memory
77 int h = 0;
78 unsigned int k = 0;
79 int l[8];
80 int i, j;
82 if (strcmp (w, "1") == 0)
83 h = 1;
85 for (i = 0; i < 256; i++)
87 for (j = 8; j > 0; j--)
88 k = 1;
89 a[i] = k;
91 for (i = 0; i < 8; i++)
92 l[i] = 0;
94 d = bar (c, c);
95 d = baz (c, 1 | foo (l[0], 10));
96 fnx (d, h);
97 fnx (e, h);
99 if (d != 0)
100 ASSERT (0);
101 return;
102 #endif