aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-10-19 19:10:20 +0000
committerJakub Jelinek <jakub@redhat.com>2009-10-19 19:10:20 +0000
commit9c78ff2cfd40fcf6ea5c9c316f249d78d758d8af (patch)
treeadc392106ea8e0639d01151dd01919f2defa7866
parent9cb6dbb646783931d1e0fbd1d31fcc23a017bc0f (diff)
Port from redhat/gcc-4_4-branch:
2009-10-08 Jakub Jelinek <jakub@redhat.com> * gcc.dg/debug/vta-2.c: New test. 2009-09-30 Alexandre Oliva <aoliva@redhat.com> * gcc.dg/debug/vta-1.c: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@152986 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/testsuite/ChangeLog9
-rw-r--r--gcc/testsuite/gcc.dg/debug/vta-1.c34
-rw-r--r--gcc/testsuite/gcc.dg/debug/vta-2.c21
3 files changed, 64 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1437ce664de..cddfb3968e3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-18 Jakub Jelinek <jakub@redhat.com>
+
+ Port from redhat/gcc-4_4-branch:
+ 2009-10-08 Jakub Jelinek <jakub@redhat.com>
+ * gcc.dg/debug/vta-2.c: New test.
+
+ 2009-09-30 Alexandre Oliva <aoliva@redhat.com>
+ * gcc.dg/debug/vta-1.c: New.
+
2009-10-19 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/noreturn2.ad[sb]: New test.
diff --git a/gcc/testsuite/gcc.dg/debug/vta-1.c b/gcc/testsuite/gcc.dg/debug/vta-1.c
new file mode 100644
index 00000000000..414083a09c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/vta-1.c
@@ -0,0 +1,34 @@
+/* https://bugzilla.redhat.com/show_bug.cgi?id=521991#c5
+
+ Distilled from Linux XFS source code. foo, inlined into bar, ends
+ up with debug stmts referencing the addressable variable b.
+ Optimization made it non-addressable, and then completely optimized
+ away, before we got a chance to rename (and discard) the occurrence
+ in the debug stmt. When we did, we crashed, attempting to rename
+ an unreference variable. */
+
+/* { dg-do compile } */
+
+static inline int
+foo (void *x, unsigned y)
+{
+ unsigned z = *(unsigned long *) x % y;
+ *(unsigned long *) x = *(unsigned long *) x / y;
+ return z;
+}
+
+struct S
+{
+ unsigned t;
+};
+
+void
+bar (struct S *x, int *y)
+{
+ int a = 0;
+ unsigned long b = x->t;
+ foo (&b, x->t);
+ for (;; a++)
+ if (b)
+ *y = 1;
+}
diff --git a/gcc/testsuite/gcc.dg/debug/vta-2.c b/gcc/testsuite/gcc.dg/debug/vta-2.c
new file mode 100644
index 00000000000..5d44262ec76
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/vta-2.c
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+
+static int
+bar (void *a, unsigned int b, int n)
+{
+ int c = *(unsigned long *) a % b;
+ *(unsigned long *) a = (int) (*(unsigned long *) a) / b;
+ return c;
+}
+
+int
+foo (unsigned long x, int *y, int z)
+{
+ int level;
+ for (level = 0; level < *y; level++)
+ {
+ bar (&x, z, sizeof (x));
+ if (x)
+ return *y - 1;
+ }
+}