summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/localalias.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-21 02:39:49 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2014-06-21 02:39:49 +0000
commit4696e459f6134e163783ea70a3bd9f8d5b2d5d0b (patch)
tree8ba8fcd6632c9c6760ff6d8527c1b70179fb50b7 /gcc/testsuite/gcc.dg/localalias.c
parent9e6b15b71856977e7dc99217054bf8e556f05cdd (diff)
downloadgcc-4696e459f6134e163783ea70a3bd9f8d5b2d5d0b.tar.gz
* gcc.dg/localalias.c: New testcase.
* gcc.dg/localalias-2.c: New testcase. * gcc.dg/globalalias.c: New testcase. * gcc.dg/globalalias-2.c: New testcase. * ipa-visibility.c (function_and_variable_visibility): Disable temporarily local aliases for some targets. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@211864 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/localalias.c')
-rw-r--r--gcc/testsuite/gcc.dg/localalias.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/localalias.c b/gcc/testsuite/gcc.dg/localalias.c
new file mode 100644
index 00000000000..3391c3ac564
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/localalias.c
@@ -0,0 +1,42 @@
+/* This test checks that local aliases behave sanely. This is necessary for code correctness
+ of aliases introduced by ipa-visibility pass.
+
+ If this test fails either aliases needs to be disabled on given target on aliases with
+ proper semantic needs to be implemented. This is problem with e.g. AIX .set pseudo-op
+ that implementes alias syntactically (by substituting in assembler) rather as alternative
+ symbol defined on a target's location. */
+
+/* { dg-do run }
+ { dg-options "-Wstrict-aliasing=2 -fstrict-aliasing" }
+ { dg-require-alias "" }
+ { dg-xfail-if "" { powerpc-ibm-aix* } { "*" } { "" } }
+ { dg-additional-sources "localalias-2.c" } */
+extern void abort (void);
+extern int test2count;
+int testcount;
+__attribute__ ((weak,noinline))
+void test(void)
+{
+ testcount++;
+}
+__attribute ((alias("test")))
+static void test2(void);
+
+void main()
+{
+ test2();
+ /* This call must bind locally. */
+ if (!testcount)
+ abort ();
+ test();
+ /* Depending on linker choice, this one may bind locally
+ or to the other unit. */
+ if (!testcount && !test2count)
+ abort();
+ tt();
+
+ if ((testcount != 1 || test2count != 3)
+ && (testcount != 3 || test2count != 1))
+ abort ();
+ reutrn 0;
+}