aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr117420.c
blob: 854768e61d3ea866d03eaf1153b5fc5acc1f7b6f (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
46
47
48
49
50
51
52
/* PR tree-optimization/117420 */
/* { dg-do run } */

int a;

__attribute__((noipa)) int
foo ()
{
  int b = -(1 | -(a < 1));
  int c = (~b & 2) / 2;
  if (b != 1)
    __builtin_abort ();
}

__attribute__((noipa)) int
bar ()
{
  int b = -(1 | -(a < 1));
  int c = (~b & 2) / 2;
  if (b != -1)
    __builtin_abort ();
}

__attribute__((noipa)) int
baz ()
{
  int b = -(1 | -(a < 1));
  int c = (~b & 2) / 2;
  if (c != 1)
    __builtin_abort ();
}

__attribute__((noipa)) int
qux ()
{
  int b = -(1 | -(a < 1));
  int c = (~b & 2) / 2;
  if (c != 0)
    __builtin_abort ();
}

int
main ()
{
  foo ();
  a = 1;
  bar ();
  a = 0;
  baz ();
  a = 1;
  qux ();
}