aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr41463.c
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2009-09-25 20:51:40 +0000
committerCary Coutant <ccoutant@google.com>2009-09-25 20:51:40 +0000
commit90ff80ffce47736ab7319058a44a0704a7fdb31e (patch)
tree3de65ba61f89a48c0ec028672acb475ea3f1819b /gcc/testsuite/gcc.c-torture/execute/pr41463.c
parentebd9739bcfd2dc4c6409fb0b96d95894191b2c28 (diff)
Merged revisions 151950:152181 from trunk.dwarf4
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/dwarf4@152186 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/pr41463.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr41463.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr41463.c b/gcc/testsuite/gcc.c-torture/execute/pr41463.c
new file mode 100644
index 00000000000..c410fe0218b
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr41463.c
@@ -0,0 +1,56 @@
+#include <stdlib.h>
+
+union tree_node;
+
+struct tree_common
+{
+ int a;
+ long b;
+ long c;
+ void *p;
+ int d;
+};
+
+struct other_tree
+{
+ struct tree_common common;
+ int arr[14];
+};
+
+struct tree_vec
+{
+ struct tree_common common;
+ int length;
+ union tree_node *a[1];
+};
+
+union tree_node
+{
+ struct other_tree othr;
+ struct tree_vec vec;
+};
+
+union tree_node global;
+
+union tree_node * __attribute__((noinline))
+foo (union tree_node *p, int i)
+{
+ union tree_node **q;
+ p->vec.a[i] = (union tree_node *) 0;
+ q = &p->vec.a[1];
+ *q = &global;
+ return p->vec.a[i];
+}
+
+extern void abort (void);
+extern void *malloc (__SIZE_TYPE__);
+
+int
+main()
+{
+ union tree_node *p = malloc (sizeof (union tree_node));
+ if (foo (p, 1) != &global)
+ abort ();
+ return 0;
+}
+