[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / localalias.c
blobfb62066a2b4b5d36127673c8529f150852e1defb
1 /* This test checks that local aliases behave sanely. This is necessary for code correctness
2 of aliases introduced by ipa-visibility pass.
4 If this test fails either aliases needs to be disabled on given target on aliases with
5 proper semantic needs to be implemented. This is problem with e.g. AIX .set pseudo-op
6 that implementes alias syntactically (by substituting in assembler) rather as alternative
7 symbol defined on a target's location. */
9 /* { dg-do run }
10 { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" }
11 { dg-require-alias "" }
12 { dg-additional-sources "localalias-2.c" } */
13 extern void abort (void);
14 extern void tt (void);
15 extern int test2count;
16 int testcount;
17 __attribute__ ((weak,noinline))
18 void test(void)
20 testcount++;
22 __attribute ((alias("test")))
23 static void test2(void);
25 int main()
27 test2();
28 /* This call must bind locally. */
29 if (!testcount)
30 abort ();
31 test();
32 /* Depending on linker choice, this one may bind locally
33 or to the other unit. */
34 if (!testcount && !test2count)
35 abort();
36 tt();
38 if ((testcount != 1 || test2count != 3)
39 && (testcount != 3 || test2count != 1))
40 abort ();
41 return 0;