public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Patch, fortran] PR37706 - [4.3, 4.4 Regression] ICE with use only and equivalent
@ 2008-10-05  6:41 Paul Richard Thomas
  0 siblings, 0 replies; only message in thread
From: Paul Richard Thomas @ 2008-10-05  6:41 UTC (permalink / raw)
  To: Fortran List, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 55 bytes --]

Committed to trunk as obvious - revision 140879.

Paul

[-- Attachment #2: submit.diff --]
[-- Type: application/octet-stream, Size: 2673 bytes --]

Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(revision 140873)
+++ gcc/fortran/ChangeLog	(working copy)
@@ -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
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c	(revision 140873)
+++ gcc/fortran/module.c	(working copy)
@@ -3806,11 +3806,14 @@
 	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;
Index: gcc/testsuite/ChangeLog
===================================================================
--- gcc/testsuite/ChangeLog	(revision 140873)
+++ gcc/testsuite/ChangeLog	(working copy)
@@ -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.
Index: gcc/testsuite/gfortran.dg/module_equivalence_4.f90
===================================================================
--- gcc/testsuite/gfortran.dg/module_equivalence_4.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/module_equivalence_4.f90	(revision 0)
@@ -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" } }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-10-05  5:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-05  6:41 [Patch, fortran] PR37706 - [4.3, 4.4 Regression] ICE with use only and equivalent Paul Richard Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).