summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-pr24141.c
blob: a36e66e4df7477c46d1ce311c332643050d2fdc3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
   pr24141.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

// reduced testcase, compile with -O2. Also, with --disable-checking
// gcc produces wrong code.

int i;

void g (void)
{
  i = 1;
}

void f (int a, int b)
{
  int c = 0;
  if (a == 0)
    c = 1;
  if (c)
    return;
  if (c == 1)
    c = 0;
  if (b == 0)
    c = 1;
  if (c)
    g ();
}

void
testTortureExecute (void)
{
  f (1, 0);
  if (i != 1)
    ASSERT (0);
  return;
}