OSDN Git Service

2007-10-19 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Oct 2007 11:38:55 +0000 (11:38 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 19 Oct 2007 11:38:55 +0000 (11:38 +0000)
        * gcc.c-torture/execute/20071018-1.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129485 138bc75d-0d04-0410-961f-82ee72b054a4

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

index a22c812..fb172cd 100644 (file)
@@ -1,5 +1,9 @@
 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
        * gfortran.dg/pr32921.f: New testcase.
 
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;
+}