summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/opt/pr23454.C
blob: ab82b1f9b5f02f2d1d90d289532531eaa1e4085f (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
/* PR rtl-optimization/23454 */
/* { dg-do compile } */
/* { dg-options "-O2" } */

void foo ();
int a, b;
char c;
long long d, e;

static inline int
bar (const long long s, const long long t)
{
  return ((s < t) ? -1 : s > t ? 1 : 0);
}

int fn ();
int f;

void
baz (int x)
{
  long long g = fn ();
  if (f)
    {
      b++;
      return;
    }
  if (g == 0)
    a++;
  if (x)
    foo ();
  if (!c)
    c = 1;
  else if (g != 0)
    {
      if (bar (g, d) < 0)
	d = g;
      if (bar (g, e) > 0)
	e = g;
    }
}