OSDN Git Service

2008-11-19 Paul Thomas <pault@gcc.gnu.org>
authorpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Nov 2008 03:25:00 +0000 (03:25 +0000)
committerpault <pault@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 19 Nov 2008 03:25:00 +0000 (03:25 +0000)
PR fortran/38119
* module.c (load_equiv): Regression fix; check that equivalence
members come from the same module only.

2008-11-19  Paul Thomas  <pault@gcc.gnu.org>

* gfortran.dg/module_equivalence_6.f90: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@141990 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/module.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/module_equivalence_6.f90 [new file with mode: 0644]

index 69d8df2..352cc31 100644 (file)
@@ -1,3 +1,9 @@
+2008-11-19  Paul Thomas  <pault@gcc.gnu.org>
+
+       PR fortran/38119
+       * module.c (load_equiv): Regression fix; check that equivalence
+       members come from the same module only.
+
 2008-11-16  Mikael Morin <mikael.morin@tele2.fr>
 
        PR fortran/35681
index b9c99fe..35f5ce5 100644 (file)
@@ -3807,12 +3807,14 @@ load_equiv (void)
       }
 
     /* Unused equivalence members have a unique name.  In addition, it
-       must be checked that the symbol is that from the module.  */
+       must be checked that the symbols are from the same module.  */
     unused = true;
     for (eq = head; eq; eq = eq->eq)
       {
        if (eq->expr->symtree->n.sym->module
-             && strcmp (module_name, eq->expr->symtree->n.sym->module) == 0
+             && head->expr->symtree->n.sym->module
+             && strcmp (head->expr->symtree->n.sym->module,
+                        eq->expr->symtree->n.sym->module) == 0
              && !check_unique_name (eq->expr->symtree->name))
          {
            unused = false;
index 4f49d7f..135ca37 100644 (file)
@@ -1,3 +1,7 @@
+2008-11-19  Paul Thomas  <pault@gcc.gnu.org>
+
+       * gfortran.dg/module_equivalence_6.f90: New test.
+
 2008-11-18  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/38051
diff --git a/gcc/testsuite/gfortran.dg/module_equivalence_6.f90 b/gcc/testsuite/gfortran.dg/module_equivalence_6.f90
new file mode 100644 (file)
index 0000000..8c8049e
--- /dev/null
@@ -0,0 +1,22 @@
+! { dg-do compile }
+!
+! Fixes PR38171 a regression caused by the fix for PR37706.
+!
+! Contributed by Scot Breitenfeld <brtnfld@hdfgroup.org>
+!
+MODULE H5GLOBAL
+  IMPLICIT NONE
+  INTEGER :: H5P_flags
+  INTEGER :: H5P_DEFAULT_F
+  EQUIVALENCE(H5P_flags, H5P_DEFAULT_F)
+END MODULE H5GLOBAL
+MODULE HDF5
+  USE H5GLOBAL
+END MODULE HDF5
+PROGRAM fortranlibtest
+  USE HDF5
+  IMPLICIT NONE
+  INTEGER :: ii
+  ii = H5P_DEFAULT_F 
+END PROGRAM fortranlibtest
+! { dg-final { cleanup-modules "H5GLOBAL HD5" } }