summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-pr40747.c
blob: 9dbe7d6fe282e7255642939a94568156a09c2b0b (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
/*
   pr40747.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c99
#endif

/* PR middle-end/40747 */

int
foo (int i)
{
  return (i < 4 && i >= 0) ? i : 4;
}

void
testTortureExecute (void)
{
  if (foo (-1) != 4) ASSERT (0);
  if (foo (0) != 0) ASSERT (0);
  if (foo (1) != 1) ASSERT (0);
  if (foo (2) != 2) ASSERT (0);
  if (foo (3) != 3) ASSERT (0);
  if (foo (4) != 4) ASSERT (0);
  if (foo (5) != 4) ASSERT (0);
  return;
}