Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr46076.c

raw
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
3
4 extern void link_error (void);
5
6 typedef unsigned char(*Calculable)(void);
7
8 static unsigned char one() { return 1; }
9 static unsigned char two() { return 2; }
10
11 static int
12 print(Calculable calculate)
13 {
14 return calculate() + calculate() + 1;
15 }
16
17 int
18 main()
19 {
20 /* Make sure we perform indirect inlining of one and two and optimize
21 the result to a constant. */
22 for (int i = 0; i < 100; i++)
23 {
24 if (print(one) != 3)
25 link_error ();
26 if (print(two) != 5)
27 link_error ();
28 }
29 return 0;
30 }