1 /*
2    pr24141.c from the execute part of the gcc torture tests.
3  */
4 
5 #include <testfwk.h>
6 
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
10 
11 // reduced testcase, compile with -O2. Also, with --disable-checking
12 // gcc produces wrong code.
13 
14 int i;
15 
g(void)16 void g (void)
17 {
18   i = 1;
19 }
20 
f(int a,int b)21 void f (int a, int b)
22 {
23   int c = 0;
24   if (a == 0)
25     c = 1;
26   if (c)
27     return;
28   if (c == 1)
29     c = 0;
30   if (b == 0)
31     c = 1;
32   if (c)
33     g ();
34 }
35 
36 void
testTortureExecute(void)37 testTortureExecute (void)
38 {
39   f (1, 0);
40   if (i != 1)
41     ASSERT (0);
42   return;
43 }
44 
45