Dead
[official-gcc.git] / gomp-20050608-branch / gcc / testsuite / gcc.dg / weak / weak-14.c
blob33c7933f1e25f97742fa5523646a1535f83e4a9c
1 // { dg-do run }
2 // { dg-require-weak "" }
3 // { dg-require-alias "" }
4 // { dg-options "-O2 -fno-common" }
6 // Copyright 2005 Free Software Foundation, Inc.
7 // Contributed by Alexandre Oliva <aoliva@redhat.com>
9 // PR middle-end/24295
11 // The unit-at-a-time call graph code used to fail to emit variables
12 // without external linkage that were only used indirectly, through
13 // aliases. We might then get linker failures because the static
14 // variable was not defined, or run-time errors because the weak alias
15 // ended up pointing somewhere random.
17 #include <stdlib.h>
19 static unsigned long lv1 = 0xdeadbeefUL;
20 #pragma weak Av1a = lv1
21 extern unsigned long Av1a;
23 static unsigned long lf1(void) { return 0x510bea7UL; }
24 #pragma weak Af1a = lf1
25 extern unsigned long Af1a(void);
27 int main (void) {
28 if (! &Av1a
29 || ! &Af1a
30 || Av1a != 0xdeadbeefUL
31 || Af1a() != 0x510bea7UL)
32 abort ();
33 exit (0);