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-990811-1.c
blobdebf332465a1e77e349d65a9da5b3a62d236aadf
1 /*
2 990811-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 struct s {long a; int b;};
13 int foo(int x, void *y)
15 switch(x) {
16 case 0: return ((struct s*)y)->a;
17 case 1: return *(signed char*)y;
18 case 2: return *(short*)y;
20 ASSERT(0);
23 void
24 testTortureExecute (void)
26 struct s s;
27 short sh[10];
28 signed char c[10];
29 int i;
31 s.a = 1;
32 s.b = 2;
33 for (i = 0; i < 10; i++) {
34 sh[i] = i;
35 c[i] = i;
38 if (foo(0, &s) != 1) ASSERT(0);
39 if (foo(1, c+3) != 3) ASSERT(0);
40 if (foo(2, sh+3) != 3) ASSERT(0);
41 return;