]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
20071018-1.c: New testcase.
authorRichard Guenther <rguenther@suse.de>
Fri, 19 Oct 2007 11:38:55 +0000 (11:38 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 19 Oct 2007 11:38:55 +0000 (11:38 +0000)
2007-10-19  Richard Guenther  <rguenther@suse.de>

        * gcc.c-torture/execute/20071018-1.c: New testcase.

From-SVN: r129485

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

index a22c81275d32a8d40511e5358df23d7d58a750ee..fb172cd9239392a07276babe9391a1c674c761a0 100644 (file)
@@ -1,3 +1,7 @@
+2007-10-19  Richard Guenther  <rguenther@suse.de>
+
+       * gcc.c-torture/execute/20071018-1.c: New testcase.
+
 2007-10-19  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/32921
diff --git a/gcc/testsuite/gcc.c-torture/execute/20071018-1.c b/gcc/testsuite/gcc.c-torture/execute/20071018-1.c
new file mode 100644 (file)
index 0000000..ae13c73
--- /dev/null
@@ -0,0 +1,31 @@
+extern void abort(void);
+
+struct foo {
+  int rank;
+  char *name;
+};
+
+struct mem {
+  struct foo *x[4];
+};
+
+void __attribute__((noinline)) bar(struct foo **f)
+{
+  *f = __builtin_malloc(sizeof(struct foo));
+}
+struct foo * foo(int rank)
+{
+  void *x = __builtin_malloc(sizeof(struct mem));
+  struct mem *as = x;
+  struct foo **upper = &as->x[rank * 8 - 1];
+  *upper = 0;
+  bar(upper);
+  return *upper;
+}
+
+int main()
+{
+  if (foo(0) == 0)
+    abort ();
+  return 0;
+}