Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20170111-1.c
blob25b3a1f0f782d5da83d166417a68b44d15bd4b01
1 /*
2 20170111-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 /* PR rtl-optimization/79032 */
12 /* Reported by Daniel Cederman <cederman@gaisler.com> */
14 #ifndef __SDCC_pdk14 // Lack of memory
15 struct S {
16 short a;
17 long long b;
18 short c;
19 char d;
20 unsigned short e;
21 long *f;
24 static long foo (struct S *s);
26 static long foo (struct S *s)
28 long a = 1;
29 a /= s->e;
30 s->f[a]--;
31 return a;
33 #endif
35 void
36 testTortureExecute (void)
38 #ifndef __SDCC_pdk14 // Lack of memory
39 long val = 1;
40 struct S s = { 0, 0, 0, 0, 2, &val };
41 val = foo (&s);
42 if (val != 0)
43 ASSERT (0);
44 #endif