PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / constructor-1.c
blobf907ce87b920b84f41e233a02da22688db96127a
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-skip-if "" { ! global_constructor } } */
5 /* The ipa-split pass pulls the body of the if(!x) block
6 into a separate function to make foo a better inlining
7 candidate. Make sure this new function isn't also run
8 as a static constructor. */
10 #include <stdlib.h>
12 int x, y;
14 void __attribute__((noinline))
15 bar(void)
17 y++;
20 void __attribute__((constructor))
21 foo(void)
23 if (!x)
25 bar();
26 y++;
30 int main()
32 x = 1;
33 foo();
34 foo();
35 if (y != 2)
36 abort();
37 exit(0);