OSDN Git Service

2011-01-17 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Jan 2011 11:50:47 +0000 (11:50 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Jan 2011 11:50:47 +0000 (11:50 +0000)
PR tree-optimization/45967
* gcc.dg/torture/pr45967-2.c: New testcase.
* gcc.dg/torture/pr45967-3.c: Likewise.

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

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr45967-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr45967-3.c [new file with mode: 0644]

index 4d30838..37955d7 100644 (file)
@@ -1,3 +1,9 @@
+2011-01-17  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/45967
+       * gcc.dg/torture/pr45967-2.c: New testcase.
+       * gcc.dg/torture/pr45967-3.c: Likewise.
+
 2011-01-16  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR testsuite/47325
diff --git a/gcc/testsuite/gcc.dg/torture/pr45967-2.c b/gcc/testsuite/gcc.dg/torture/pr45967-2.c
new file mode 100644 (file)
index 0000000..6959fd5
--- /dev/null
@@ -0,0 +1,24 @@
+/* { dg-do run } */
+
+extern void abort (void);
+int b;
+void
+foo (void *p_, int *q)
+{
+  int *p;
+  int i;
+  for (i = 0; i < sizeof(int *); ++i)
+    ((char *)&p)[i] = ((char *)p_)[i];
+  if (b)
+    p = q;
+  *p = 1;
+}
+int main()
+{
+  int i = 0, j;
+  int *p = &i;
+  foo (&p, &j);
+  if (i != 1)
+    abort ();
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr45967-3.c b/gcc/testsuite/gcc.dg/torture/pr45967-3.c
new file mode 100644 (file)
index 0000000..1a23a77
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+
+extern void abort (void);
+void
+foo (void *p_)
+{
+  int *p;
+  int i;
+  for (i = 0; i < sizeof(int *); ++i)
+    ((char *)&p)[i] = ((char *)p_)[i];
+  *p = 1;
+}
+int main()
+{
+  int i = 0;
+  int *p = &i;
+  foo (&p);
+  if (i != 1)
+    abort ();
+  return 0;
+}