From 81a7154e5792c6ee7530935c21a1a0e6d06104d3 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Wed, 19 Nov 2008 03:25:00 +0000 Subject: [PATCH] re PR fortran/38119 (character ICE in gfc_trans_create_temp_array) 2008-11-19 Paul Thomas PR fortran/38119 * module.c (load_equiv): Regression fix; check that equivalence members come from the same module only. 2008-11-19 Paul Thomas * gfortran.dg/module_equivalence_6.f90: New test. From-SVN: r141990 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/module.c | 6 ++++-- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gfortran.dg/module_equivalence_6.f90 | 22 ++++++++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gfortran.dg/module_equivalence_6.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 69d8df2..352cc31 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2008-11-19 Paul Thomas + + PR fortran/38119 + * module.c (load_equiv): Regression fix; check that equivalence + members come from the same module only. + 2008-11-16 Mikael Morin PR fortran/35681 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index b9c99fe..35f5ce5 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4f49d7f..135ca37 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-11-19 Paul Thomas + + * gfortran.dg/module_equivalence_6.f90: New test. + 2008-11-18 Jakub Jelinek 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 index 0000000..8c8049e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/module_equivalence_6.f90 @@ -0,0 +1,22 @@ +! { dg-do compile } +! +! Fixes PR38171 a regression caused by the fix for PR37706. +! +! Contributed by Scot Breitenfeld +! +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" } } -- 2.7.4