aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr111469-1.c
blob: b68d5989eaca38ced53a917fbab904213a9f1752 (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
/* PR tree-optimization/111469 */

long f;
char *g;
__attribute__((noinline))
char o() {
  char l;
  while (f)
    ;
  l = *g;
  return l;
}

/* factor_out_conditional_conversion is able to remove the casts
   from the 2 bbs (correctly)
   but then minmax_replacement should not optimize this to a MIN_EXPR
   as o has side effects. */

__attribute__((noinline))
unsigned short gg(unsigned short a, unsigned short b)
{
  short d;
  if (a > b)
  {
    d= b;
  }
  else
  {
    o();
    d = a;
  }
  return d;
}

int main(void)
{
  gg(3, 2);
}