diff options
author | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-06-05 16:54:53 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2015-06-05 16:54:53 +0000 |
commit | e5609c8fee62ea24f5fcfa1e3aa7131b1ec18afc (patch) | |
tree | a0e126c4948d37e3b7aee1084b445bde8dd93a61 /gcc | |
parent | 712266515f4ba06d8a2d90584984f461a37b5d68 (diff) | |
download | gcc-e5609c8fee62ea24f5fcfa1e3aa7131b1ec18afc.zip gcc-e5609c8fee62ea24f5fcfa1e3aa7131b1ec18afc.tar.gz gcc-e5609c8fee62ea24f5fcfa1e3aa7131b1ec18afc.tar.bz2 |
[multiple changes]
2015-06-03 Russell Whitesides <russelldub@gmail.com>
Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/40958
PR fortran/60780
PR fortran/66377
* module.c (load_equiv): Add check for loading duplicate EQUIVALENCEs
from different modules. Eliminate the pruning of unused
equivalence-objects
2015-06-03 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66377
gfortran.dg/equiv_9.f90: New test.
From-SVN: r224159
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fortran/module.c | 22 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/equiv_9.f90 | 22 |
4 files changed, 47 insertions, 13 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index b446e90..2bf6717 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2015-06-05 Russell Whitesides <russelldub@gmail.com> + Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/40958 + PR fortran/60780 + PR fortran/66377 + * module.c (load_equiv): Add check for loading duplicate EQUIVALENCEs + from different modules. Eliminate the pruning of unused + equivalence-objects + 2015-06-04 Thomas Koenig <tkoenig@netcologne.de> PR fortran/58749 diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 4122c95..e183d90 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -4476,8 +4476,8 @@ load_commons (void) static void load_equiv (void) { - gfc_equiv *head, *tail, *end, *eq; - bool unused; + gfc_equiv *head, *tail, *end, *eq, *equiv; + bool duplicate; mio_lparen (); in_load_equiv = true; @@ -4504,23 +4504,19 @@ load_equiv (void) mio_expr (&tail->expr); } - /* Unused equivalence members have a unique name. In addition, it - must be checked that the symbols are from the same module. */ - unused = true; - for (eq = head; eq; eq = eq->eq) + /* Check for duplicate equivalences being loaded from different modules */ + duplicate = false; + for (equiv = gfc_current_ns->equiv; equiv; equiv = equiv->next) { - if (eq->expr->symtree->n.sym->module - && 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)) + if (equiv->module && head->module + && strcmp (equiv->module, head->module) == 0) { - unused = false; + duplicate = true; break; } } - if (unused) + if (duplicate) { for (eq = head; eq; eq = head) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c5adc35..e962383 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-06-05 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/66377 + gfortran.dg/equiv_9.f90: New test. + + 2015-06-05 Tom de Vries <tom@codesourcery.com> merge from gomp4 branch: diff --git a/gcc/testsuite/gfortran.dg/equiv_9.f90 b/gcc/testsuite/gfortran.dg/equiv_9.f90 new file mode 100644 index 0000000..28f0bb8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/equiv_9.f90 @@ -0,0 +1,22 @@ +! { dg-do run } +! PR fortran/66377 +! +module constant + integer x1, x2, x3 + integer x(3) + equivalence (x(1),x1), (x2,x(2)), (x3,x(3)) +end module + +program test + use constant + implicit none + x = (/1, 2, 3/) + call another() +end program + +subroutine another() + use constant, only : x2 + implicit none + if (x2 /= 2) call abort +end subroutine +! { dg-final { cleanup-modules "constant" } } |