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

#include <testfwk.h>

#ifdef __SDCC
#pragma disable_warning 84
#endif

/* PR tree-optimization/78675 */

long int a;

long int
foo (long int x)
{
  long int b;
  while (a < 1)
    {
      b = a && x;
      ++a;
    }
  return b;
}

void
testTortureExecute (void)
{
  ASSERT (foo (0) == 0);
  a = 0;
  ASSERT (foo (1) == 0);
  a = 0;
  ASSERT (foo (25) == 0);
  a = -64;
  ASSERT (foo (0) == 0);
  a = -64;
  ASSERT (foo (1) == 0);
  a = -64;
  ASSERT (foo (25) == 0);
  return;
}