This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Add testcase for PR lto/60820
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Apr 2014 04:33:47 +0200
- Subject: Add testcase for PR lto/60820
- Authentication-results: sourceware.org; auth=none
Hi,
this is stand alone testcase for that PR.
Comitted to mainline.
PR lto/60820
* gcc.dg/lto/pr60820_0.c: New testcase.
* gcc.dg/lto/pr60820_1.c: New testcase.
Index: testsuite/gcc.dg/lto/pr60820_1.c
===================================================================
--- testsuite/gcc.dg/lto/pr60820_1.c (revision 0)
+++ testsuite/gcc.dg/lto/pr60820_1.c (revision 0)
@@ -0,0 +1,11 @@
+#include <stdio.h>
+struct in6_addr {int bah;};
+extern const struct in6_addr in6addr_any;
+static const struct in6_addr local_in6addr_any = {1};
+#pragma weak in6addr_any = local_in6addr_any
+
+__attribute__ ((used))
+void foo()
+{
+ fprintf (stderr, "v1: %p, v2: %p\n", &local_in6addr_any, &in6addr_any);
+}
Index: testsuite/gcc.dg/lto/pr60820_0.c
===================================================================
--- testsuite/gcc.dg/lto/pr60820_0.c (revision 0)
+++ testsuite/gcc.dg/lto/pr60820_0.c (revision 0)
@@ -0,0 +1,13 @@
+/* { dg-lto-do link } */
+/* { dg-lto-options {{-flto -r -nostdlib -O2}} } */
+#include <stdio.h>
+struct in6_addr {int bah;};
+extern const struct in6_addr in6addr_any;
+static const struct in6_addr local_in6addr_any = {1};
+#pragma weak in6addr_any = local_in6addr_any
+
+__attribute__ ((used))
+void foo2()
+{
+ fprintf (stderr, "v1: %p, v2: %p\n", &local_in6addr_any, &in6addr_any);
+}