summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr48837.c
blob: ffc65b9dc8c58df688d8eb24bf94f19f1866a566 (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
/* PR tree-optimization/48837 */
/* { dg-do run } */
/* { dg-options "-O2" } */

void abort (void);

__attribute__((noinline))
int baz(void)
{
  return 1;
}

inline const int *bar(const int *a, const int *b)
{
 return *a ? a : b;
}

int foo(int a, int b)
{
   return a || b ? baz() : foo(*bar(&a, &b), 1) + foo(1, 0);
}

int main(void)
{
 if (foo(0, 0) != 2)
   abort();

 return 0;
}