* gcc.c-torture/execute/lto-tbaa-1.c: New testcase.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 24 Nov 2015 03:58:47 +0000 (04:58 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 24 Nov 2015 03:58:47 +0000 (03:58 +0000)
From-SVN: r230784

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/lto-tbaa-1.c [new file with mode: 0644]

index 61b3e757a8047192e36c2e196814248ba607be0f..2114f8fa85f6a0b652d4ecc8a2a02cf6ca958cec 100644 (file)
@@ -1,3 +1,7 @@
+2015-11-23  Jan Hubicka  <hubicka@ucw.cz>
+
+       * gcc.c-torture/execute/lto-tbaa-1.c: New testcase.
+
 2015-11-23  David Malcolm  <dmalcolm@redhat.com>
 
        PR objc/68438
diff --git a/gcc/testsuite/gcc.c-torture/execute/lto-tbaa-1.c b/gcc/testsuite/gcc.c-torture/execute/lto-tbaa-1.c
new file mode 100644 (file)
index 0000000..fe1e177
--- /dev/null
@@ -0,0 +1,42 @@
+/* { dg-additional-options "-fno-early-inlining -fno-ipa-cp" }  */
+struct a {
+  float *b;
+} *a;
+struct b {
+  int *b;
+} b;
+struct c {
+  float *b;
+} *c;
+int d;
+use_a (struct a *a)
+{
+}
+set_b (int **a)
+{
+  *a=&d;
+}
+use_c (struct c *a)
+{
+}
+__attribute__ ((noinline)) int **retme(int **val)
+{
+  return val;
+}
+int e;
+struct b b= {&e};
+struct b b2;
+struct b b3;
+int **ptr = &b2.b;
+main ()
+{
+  a= (void *)0;
+  b.b=&e;
+  ptr =retme ( &b.b);
+  set_b (ptr);
+  b3=b;
+  if (b3.b != &d)
+  __builtin_abort ();
+  c= (void *)0;
+  return 0;
+}