Adjust scan string for PIE
[official-gcc.git] / gcc / testsuite / gcc.dg / constructor-1.c
blob1095a455cfa66786ae307382aea72605adf022c2
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
4 /* The ipa-split pass pulls the body of the if(!x) block
5 into a separate function to make foo a better inlining
6 candidate. Make sure this new function isn't also run
7 as a static constructor. */
9 #include <stdlib.h>
11 int x, y;
13 void __attribute__((noinline))
14 bar(void)
16 y++;
19 void __attribute__((constructor))
20 foo(void)
22 if (!x)
24 bar();
25 y++;
29 int main()
31 x = 1;
32 foo();
33 foo();
34 if (y != 2)
35 abort();
36 exit(0);