OSDN Git Service

gcc/ChangeLog:
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / attr-alias-3.c
1 // { dg-do link }
2 // { dg-require-alias "" }
3 // { dg-options "-O2 -fno-common" }
4
5 // Copyright 2005 Free Software Foundation, Inc.
6 // Contributed by Alexandre Oliva <aoliva@redhat.com>
7
8 // PR middle-end/24295
9
10 // The unit-at-a-time call graph code used to fail to emit variables
11 // without external linkage that were only used indirectly, through
12 // aliases.  Although the PR above is about #pragma weak-introduced
13 // aliases, the underlying machinery is the same.
14
15 #ifndef ATTRIBUTE_USED
16 # define ATTRIBUTE_USED __attribute__((used))
17 #endif
18
19 static int lv1;
20 extern int Av1a __attribute__((alias ("lv1")));
21 int *pv1a = &Av1a;
22
23 static int lv2;
24 extern int Av2a __attribute__((alias ("lv2")));
25 int *pv2a = &lv2;
26
27 static int lv3;
28 extern int Av3a __attribute__((alias ("lv3")));
29 static int *pv3a ATTRIBUTE_USED = &Av3a;
30
31 static int lv4;
32 extern int Av4a __attribute__((alias ("lv4")));
33 static int *pv4a = &Av4a;
34
35 typedef void ftype(void);
36
37 static void lf1(void) {}
38 extern ftype Af1a __attribute__((alias ("lf1")));
39 ftype *pf1a = &Af1a;
40
41 static void lf2(void) {}
42 extern ftype Af2a __attribute__((alias ("lf2")));
43 ftype *pf2a = &Af2a;
44
45 static void lf3(void) {}
46 extern ftype Af3a __attribute__((alias ("lf3")));
47 static ftype *pf3a ATTRIBUTE_USED = &Af3a;
48
49 static void lf4(void) {}
50 extern ftype Af4a __attribute__((alias ("lf4")));
51 static ftype *pf4a = &Af4a;
52
53 main() {
54   asm volatile ("" : : "m" (pv4a), "m" (pf4a));
55 }