aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr81588.c
blob: b8f84b3e18c42075205fe8aaaaf9777b3662ff44 (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
45
/* PR tree-optimization/81588 */

__attribute__((noinline, noclone)) int
bar (int x)
{
  __asm volatile ("" : : "g" (x) : "memory");
}

__attribute__((noinline, noclone)) int
foo (unsigned x, long long y)
{
  if (y < 0)
    return 0;
  if (y < (long long) (4 * x))
    {
      bar (y);
      return 1;
    }
  return 0;
}     

int
main ()
{
  volatile unsigned x = 10;
  volatile long long y = -10000;
  if (foo (x, y) != 0)
    __builtin_abort ();
  y = -1;
  if (foo (x, y) != 0)
    __builtin_abort ();
  y = 0;
  if (foo (x, y) != 1)
    __builtin_abort ();
  y = 39;
  if (foo (x, y) != 1)
    __builtin_abort ();
  y = 40;
  if (foo (x, y) != 0)
    __builtin_abort ();
  y = 10000;
  if (foo (x, y) != 0)
    __builtin_abort ();
  return 0;
}