http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47839
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-debug
--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-02-22
12:01:03 UTC ---
With the patch and
MODULE PEC_mod
CONTAINS
SUBROUTINE PECapply(Ex)
USE globalvar_mod, ONLY : xstop
real(kind=8), dimension(1:xstop), intent(inout) :: Ex
write(*,*) xstop
END SUBROUTINE PECapply
SUBROUTINE PECapply2(Ex)
USE globalvar_mod, ONLY : xstop
real(kind=8), dimension(1:xstop), intent(inout) :: Ex
write(*,*) xstop
END SUBROUTINE PECapply2
END MODULE PEC_mod
you see
pecapply2 (real(kind=8)[0:] * restrict ex)
{
extern integer(kind=4)D.8 xstopD.1540;
{
struct __st_parameter_dt dt_parm.0D.1539;
dt_parm.0D.1539.commonD.1458.filenameD.1355 = &"t.f90"[1]{lb: 1 sz: 1};
dt_parm.0D.1539.commonD.1458.lineD.1356 = 11;
dt_parm.0D.1539.commonD.1458.flagsD.1353 = 128;
dt_parm.0D.1539.commonD.1458.unitD.1354 = 6;
_gfortran_st_write (&dt_parm.0D.1539);
_gfortran_transfer_integer_write (&dt_parm.0D.1539, &xstopD.1538, 4);
_gfortran_st_write_done (&dt_parm.0D.1539);
}
}
pecapply (real(kind=8)[0:] * restrict ex)
{
{
struct __st_parameter_dt dt_parm.1D.1543;
dt_parm.1D.1543.commonD.1458.filenameD.1355 = &"t.f90"[1]{lb: 1 sz: 1};
dt_parm.1D.1543.commonD.1458.lineD.1356 = 6;
dt_parm.1D.1543.commonD.1458.flagsD.1353 = 128;
dt_parm.1D.1543.commonD.1458.unitD.1354 = 6;
_gfortran_st_write (&dt_parm.1D.1543);
_gfortran_transfer_integer_write (&dt_parm.1D.1543, &xstopD.1538, 4);
_gfortran_st_write_done (&dt_parm.1D.1543);
}
}
which is half-way sane (same backend-decl used for the actual USE
associated variable). But still the 2nd function misses the copy
in its BLOCK tree, so I guess if that function would be nested
in another that has a local of the same name gdb would confuse
references to the USE associated vars with that of the local
parent function decl like with
MODULE PEC_mod
CONTAINS
SUBROUTINE test
integer :: xstop,xbar
write(*,*) xstop
CONTAINS
SUBROUTINE PECapply(Ex)
USE globalvar_mod, ONLY : xstop
real(kind=8), dimension(1:xstop), intent(inout) :: Ex
write(*,*) xstop,xbar
END SUBROUTINE PECapply
END SUBROUTINE test
SUBROUTINE PECapply2(Ex)
USE globalvar_mod, ONLY : xstop
real(kind=8), dimension(1:xstop), intent(inout) :: Ex
write(*,*) xstop
END SUBROUTINE PECapply2
END MODULE PEC_mod
remains to a more Fortran affine person to verify the above wrong-debug
idea with gdb. The key is
pecapply (real(kind=8)[0:] * restrict ex)
{
{
struct __st_parameter_dt dt_parm.1D.1545;
dt_parm.1D.1545.commonD.1458.filenameD.1355 = &"t.f90"[1]{lb: 1 sz: 1};
dt_parm.1D.1545.commonD.1458.lineD.1356 = 10;
dt_parm.1D.1545.commonD.1458.flagsD.1353 = 128;
dt_parm.1D.1545.commonD.1458.unitD.1354 = 6;
_gfortran_st_write (&dt_parm.1D.1545);
_gfortran_transfer_integer_write (&dt_parm.1D.1545, &xstopD.1535, 4);
_gfortran_transfer_integer_write (&dt_parm.1D.1545, &xbarD.1546, 4);
_gfortran_st_write_done (&dt_parm.1D.1545);
}
}
(no extern integer(kind=4)D.8 xstopD.1537; here) and in the parent:
test ()
{
integer(kind=4)D.8 xbarD.1546;
integer(kind=4)D.8 xstopD.1547;
static voidD.27 pecapplyD.1541 (real(kind=8)D.18[0:] * restrict);
{
struct __st_parameter_dt dt_parm.2D.1548;
dt_parm.2D.1548.commonD.1458.filenameD.1355 = &"t.f90"[1]{lb: 1 sz: 1};
dt_parm.2D.1548.commonD.1458.lineD.1356 = 5;
dt_parm.2D.1548.commonD.1458.flagsD.1353 = 128;
dt_parm.2D.1548.commonD.1458.unitD.1354 = 6;
_gfortran_st_write (&dt_parm.2D.1548);
_gfortran_transfer_integer_write (&dt_parm.2D.1548, &xstopD.1547, 4);
_gfortran_st_write_done (&dt_parm.2D.1548);
}
}
we have integer(kind=4)D.8 xstopD.1547 which shadows the global xstop
from the module.