re PR fortran/37706 (ICE with use only and equivalent)

2008-10-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/37706
	* module.c (load_equiv): Check the module before negating the
	unused flag.

2008-10-04  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/37706
	* gfortran.dg/module_equivalence_4.f90: New test.

From-SVN: r140879
This commit is contained in:
Paul Thomas 2008-10-05 05:50:00 +00:00
parent 7f23df4ebb
commit ee9ef10338
4 changed files with 45 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2008-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37706
* module.c (load_equiv): Check the module before negating the
unused flag.
2008-10-02 Steven Bosscher <steven@gcc.gnu.org>
PR fortran/37635

View file

@ -3806,11 +3806,14 @@ load_equiv (void)
mio_expr (&tail->expr);
}
/* Unused equivalence members have a unique name. */
/* Unused equivalence members have a unique name. In addition, it
must be checked that the symbol is that from the module. */
unused = true;
for (eq = head; eq; eq = eq->eq)
{
if (!check_unique_name (eq->expr->symtree->name))
if (eq->expr->symtree->n.sym->module
&& strcmp (module_name, eq->expr->symtree->n.sym->module) == 0
&& !check_unique_name (eq->expr->symtree->name))
{
unused = false;
break;

View file

@ -1,3 +1,8 @@
2008-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/37706
* gfortran.dg/module_equivalence_4.f90: New test.
2008-10-04 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-pre-21.c: New testcase.

View file

@ -0,0 +1,29 @@
! { dg-do compile }
! This checks the fix for PR37706 in which the equivalence would be
! inserted into the 'nudata' namespace with the inevitable consequences.
!
! Contributed by Lester Petrie <petrielmjr@ornl.gov>
!
module data_C
integer, dimension(200) :: l = (/(201-i, i = 1,200)/)
integer :: l0
integer :: l24, l27, l28, l29
equivalence ( l(1), l0 )
end module data_C
subroutine nudata(nlibe, a, l)
USE data_C, only: l24, l27, l28, l29
implicit none
integer :: nlibe
integer :: l(*)
real :: a(*)
print *, l(1), l(2)
return
end subroutine nudata
integer :: l_(2) = (/1,2/), nlibe_ = 42
real :: a_(2) = (/1.,2./)
call nudata (nlibe_, a_, l_)
end
! { dg-final { cleanup-modules "data_C" } }