1 /* This test checks that local aliases behave sanely. This is necessary for code correctness 2 of aliases introduced by ipa-visibility pass. 3 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. */ 8 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)) test(void)18void test(void) 19 { 20 testcount++; 21 } 22 __attribute ((alias("test"))) 23 static void test2(void); 24 main()25int main() 26 { 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(); 37 38 if ((testcount != 1 || test2count != 3) 39 && (testcount != 3 || test2count != 1)) 40 abort (); 41 return 0; 42 } 43