aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-10-05 05:50:00 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-10-05 05:50:00 +0000
commitee9ef10338020843b9df3c21297bd1c61bbd45b4 (patch)
treec7a1d5d6f65455a78af957007fe5a13885133b75 /gcc
parent7f23df4ebbb5d8e0f585501b2a702bd59d7bc16e (diff)
downloadgcc-ee9ef10338020843b9df3c21297bd1c61bbd45b4.zip
gcc-ee9ef10338020843b9df3c21297bd1c61bbd45b4.tar.gz
gcc-ee9ef10338020843b9df3c21297bd1c61bbd45b4.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/module.c7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/module_equivalence_4.f9029
4 files changed, 45 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 869cd89..d462da0 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -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
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 762114c..3846d95 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -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;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c0687c9..c0b275c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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.
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_4.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
new file mode 100644
index 0000000..7a8ef9c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/module_equivalence_4.f90
@@ -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" } }