]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/constructor-1.c
Get rid of dg-skip-if etc. default args
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / constructor-1.c
CommitLineData
2062f77b
PB
1/* { dg-do run } */
2/* { dg-options "-O2" } */
4f4b0ab8 3/* { dg-skip-if "" { ! global_constructor } } */
2062f77b
PB
4
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. */
9
10#include <stdlib.h>
11
12int x, y;
13
14void __attribute__((noinline))
15bar(void)
16{
17 y++;
18}
19
20void __attribute__((constructor))
21foo(void)
22{
23 if (!x)
24 {
25 bar();
26 y++;
27 }
28}
29
30int main()
31{
32 x = 1;
33 foo();
34 foo();
35 if (y != 2)
36 abort();
37 exit(0);
38}