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-20060930-2.c
blob810c559eb57e7c584576ff6df5ef6d3d24641926
1 /*
2 20060930-2.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 #include <string.h>
13 /* PR middle-end/29272 */
15 struct S { struct S *s; } s;
16 struct T { struct T *t; } t;
18 static inline void
19 foo (void *s)
21 struct T *p = s;
22 memcpy (&p->t, &t.t, sizeof (t.t));
25 void *
26 bar (void *p, struct S *q)
28 q->s = &s;
29 foo (p);
30 return q->s;
33 void
34 testTortureExecute (void)
36 t.t = &t;
37 if (bar (&s, &s) != (void *) &t)
38 ASSERT (0);
39 return;