Message ID | 20110607122448.GA17079@tyan-ft48-01.lab.bos.redhat.com |
---|---|
State | New |
Headers | show |
On Tue, Jun 07, 2011 at 02:24:49PM +0200, Jakub Jelinek wrote: > Fixed thusly. Additionally I've renamed a variable that was shadowing > a variable of the same name, which confused me quite a bit when debugging > it - I was expecting insn to be a DEBUG_INSN, while it was something > completely different. > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? Alex said on IRC this looks obvious to him and I agree, so I've installed it to trunk as such. > 2011-06-07 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. > > * gfortran.dg/pr49308.f90: New test. > > --- gcc/dce.c.jj 2011-06-06 19:07:08.000000000 +0200 > +++ gcc/dce.c 2011-06-07 11:08:12.000000000 +0200 > @@ -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; > } > } > } > --- gcc/testsuite/gfortran.dg/pr49308.f90.jj 2011-06-07 11:39:39.000000000 +0200 > +++ gcc/testsuite/gfortran.dg/pr49308.f90 2011-06-07 11:30:25.000000000 +0200 > @@ -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 Jakub
--- gcc/dce.c.jj 2011-06-06 19:07:08.000000000 +0200 +++ gcc/dce.c 2011-06-07 11:08:12.000000000 +0200 @@ -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; } } } --- gcc/testsuite/gfortran.dg/pr49308.f90.jj 2011-06-07 11:39:39.000000000 +0200 +++ gcc/testsuite/gfortran.dg/pr49308.f90 2011-06-07 11:30:25.000000000 +0200 @@ -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