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-pta-field-2.c
blobef4064aaf3246082950886ae56ec1c22a6006c40
1 /*
2 pta-field-2.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 struct Foo {
12 int *p;
13 int *q;
16 void
17 bar (int **x)
19 struct Foo *f = (struct Foo *)(x - 1);
20 *(f->p) = 0;
23 int foo(void)
25 struct Foo f;
26 int i = 1, j = 2;
27 f.p = &i;
28 f.q = &j;
29 bar(&f.q);
30 return i;
33 void
34 testTortureExecute (void)
36 if (foo () != 0)
37 ASSERT (0);
38 return;