libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr46076.c
blob6e5907b499599c2e47c0e3fa5c9790146060f1a5
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
4 extern void link_error (void);
6 typedef unsigned char(*Calculable)(void);
8 static unsigned char one() { return 1; }
9 static unsigned char two() { return 2; }
11 static int
12 print(Calculable calculate)
14 return calculate() + calculate() + 1;
17 int
18 main()
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++)
24 if (print(one) != 3)
25 link_error ();
26 if (print(two) != 5)
27 link_error ();
29 return 0;