aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2011-06-09 09:46:28 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2011-06-09 09:46:28 +0200
commit8ced31fe6da7fbdc1ec732d7ccbf8f3f401cee0d (patch)
tree04c78a3f0d60ea8375218ae474e406d2d7bf67f4
parent10c4cabcde3983eb6b79bb9105fd60bc0bfd4361 (diff)
downloadgcc-8ced31fe6da7fbdc1ec732d7ccbf8f3f401cee0d.zip
gcc-8ced31fe6da7fbdc1ec732d7ccbf8f3f401cee0d.tar.gz
gcc-8ced31fe6da7fbdc1ec732d7ccbf8f3f401cee0d.tar.bz2
re PR middle-end/49308 (segfault in rest_of_handle_ud_dce () at gcc/gcc/dce.c:518)
PR middle-end/49308 * dce.c (reset_unmarked_insns_debug_uses): Avoid shadowing insn variable. After resetting and rescanning insn continue with previous statement. * gfortran.dg/pr49308.f90: New test. From-SVN: r174839
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dce.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/pr49308.f9028
4 files changed, 44 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4f12db9..81aaf76 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/49308
+ * dce.c (reset_unmarked_insns_debug_uses): Avoid shadowing insn
+ variable. After resetting and rescanning insn continue with previous
+ statement.
+
2011-06-09 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* configure.ac (gcc_cv_as_hidden): Enable on *-*-darwin*.
diff --git a/gcc/dce.c b/gcc/dce.c
index 93464fe..9974325 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -514,11 +514,11 @@ reset_unmarked_insns_debug_uses (void)
struct df_link *defs;
for (defs = DF_REF_CHAIN (use); defs; defs = defs->next)
{
- rtx insn;
+ rtx ref_insn;
if (DF_REF_IS_ARTIFICIAL (defs->ref))
continue;
- insn = DF_REF_INSN (defs->ref);
- if (!marked_insn_p (insn))
+ ref_insn = DF_REF_INSN (defs->ref);
+ if (!marked_insn_p (ref_insn))
break;
}
if (!defs)
@@ -527,6 +527,7 @@ reset_unmarked_insns_debug_uses (void)
each of the DEFs? */
INSN_VAR_LOCATION_LOC (insn) = gen_rtx_UNKNOWN_VAR_LOC ();
df_insn_rescan_debug_internal (insn);
+ break;
}
}
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 465d22a..d2ebaf6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2011-06-09 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/49308
+ * gfortran.dg/pr49308.f90: New test.
+
2011-06-08 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/noexcept11.C: New.
diff --git a/gcc/testsuite/gfortran.dg/pr49308.f90 b/gcc/testsuite/gfortran.dg/pr49308.f90
new file mode 100644
index 0000000..728a5e2
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr49308.f90
@@ -0,0 +1,28 @@
+! PR middle-end/49308
+! { dg-do compile }
+! { dg-options "-O2 -funroll-loops -g" }
+
+subroutine foo(n, b, d, e)
+ type t
+ integer :: f
+ end type t
+ type s
+ type(t), pointer :: g
+ end type s
+ type u
+ type(s), dimension(:), pointer :: h
+ end type
+ integer :: i, k, n
+ type(u), pointer :: a, e
+ character(len=250) :: b, c, d
+ logical :: l
+ do i = 1, n
+ j = i - 1
+ if (j/=0) c = trim(b) // adjustl(d(j))
+ end do
+ a => e
+ do k = 1, size(a%h)
+ l = (a%h(k)%g%f == a%h(1)%g%f)
+ if (.not.(l)) call bar()
+ enddo
+end subroutine foo