aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorSteven G. Kargl <kargl@gcc.gnu.org>2016-09-10 00:52:45 +0000
committerSteven G. Kargl <kargl@gcc.gnu.org>2016-09-10 00:52:45 +0000
commit352c2128b444a858e1a273de4b7a14d293e48968 (patch)
tree8ab3ddcf9a74e2e84138365bffe81474b2ee69ea /gcc
parentc87656b4d374be9c62d9d9771a37e9888d25039a (diff)
downloadgcc-352c2128b444a858e1a273de4b7a14d293e48968.zip
gcc-352c2128b444a858e1a273de4b7a14d293e48968.tar.gz
gcc-352c2128b444a858e1a273de4b7a14d293e48968.tar.bz2
re PR fortran/77420 (gfortran and equivalence produces internal compiler error)
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77420 * module.c (load_equiv): If the current namespace has a list of equivalence statements, initialize duplicate to false and then look for duplicates; otherwise, initialize it to true. 2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org> PR fortran/77420 * gfortran.dg/pr77420.f90: New test. From-SVN: r240063
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/module.c2
-rw-r--r--gcc/testsuite/ChangeLog12
-rw-r--r--gcc/testsuite/gfortran.dg/pr77420.f9018
3 files changed, 31 insertions, 1 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index 4d664f0..18e1cee 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4647,7 +4647,7 @@ load_equiv (void)
}
/* Check for duplicate equivalences being loaded from different modules */
- duplicate = false;
+ duplicate = gfc_current_ns->equiv ? false:true;
for (equiv = gfc_current_ns->equiv; equiv; equiv = equiv->next)
{
if (equiv->module && head->module
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 3b934a0..93c2826a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/77420
+ * module.c (load_equiv): If the current namespace has a list of
+ equivalence statements, initialize duplicate to false and then
+ look for duplicates; otherwise, initialize it to true.
+
2016-09-09 Martin Sebor <msebor@redhat.com>
PR c/77520
@@ -7,6 +14,11 @@
2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
+ PR fortran/77420
+ * gfortran.dg/pr77420.f90: New test.
+
+2016-09-09 Steven G. Kargl <kargl@gcc.gnu.org>
+
PR fortran/77506
* gfortran.dg/pr77506.f90: New test.
diff --git a/gcc/testsuite/gfortran.dg/pr77420.f90 b/gcc/testsuite/gfortran.dg/pr77420.f90
new file mode 100644
index 0000000..89abe71
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/pr77420.f90
@@ -0,0 +1,18 @@
+! { dg-do compile }
+MODULE test_equivalence
+ REAL, PRIVATE, DIMENSION(100) :: array1
+ REAL, PRIVATE, DIMENSION(100) :: array2
+ EQUIVALENCE(array1(1),array2(1))
+END MODULE test_equivalence
+
+MODULE mymodule
+ USE test_equivalence
+ ! declare a local variable with the same name as the (private!)
+ ! variable in module test_equivalence:
+ REAL, DIMENSION(:), ALLOCATABLE :: array1
+END MODULE mymodule
+
+PROGRAM test
+ USE mymodule
+END PROGRAM test
+