struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-pr60003.c
blobd2f50327b8e366e16b28371b288f806fc59553be
1 /*
2 pr60003.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 #if !defined(__SDCC_pic14) // Unimplemented setjmp
12 #include <setjmp.h>
14 /* PR tree-optimization/60003 */
15 /* { dg-require-effective-target indirect_jumps } */
17 jmp_buf buf;
19 void
20 baz (void)
22 longjmp (buf, 1);
25 void
26 bar (void)
28 baz ();
31 int
32 foo (int x)
34 volatile int a = 0;
36 if (setjmp (buf) == 0)
38 while (1)
40 a = 1;
41 bar (); /* OK if baz () instead */
44 else
46 if (a == 0)
47 return 0;
48 else
49 return x;
52 #endif
54 void
55 testTortureExecute (void)
57 #if !defined(__SDCC_pic14) // Unimplemented setjmp
58 if (foo (1) == 0)
59 ASSERT (0);
60 #endif