aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2008-03-09 19:38:51 +0000
committerPaul Thomas <pault@gcc.gnu.org>2008-03-09 19:38:51 +0000
commit81c109530cdca59546cf13346588e5a8e48ec074 (patch)
treef16e6056a26aa61c3d1da107510fbc2a9e3df577 /gcc
parent802e3f8c818a594430066173ab0beb8bde96a74a (diff)
downloadgcc-81c109530cdca59546cf13346588e5a8e48ec074.zip
gcc-81c109530cdca59546cf13346588e5a8e48ec074.tar.gz
gcc-81c109530cdca59546cf13346588e5a8e48ec074.tar.bz2
re PR fortran/35474 (Reading module file with COMMON and EQUIVALENCE)
2008-03-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/35474 * module.c (mio_symtree_ref): After providing a symbol for a missing equivalence member, resolve and NULL the fixups. 2008-03-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/35474 * gfortran.dg/module_commons_2.f90 : New test. From-SVN: r133063
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/module.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gfortran.dg/module_commons_2.f9021
4 files changed, 38 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 72bf512..e660d9c 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2008-03-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35474
+ * module.c (mio_symtree_ref): After providing a symbol for a
+ missing equivalence member, resolve and NULL the fixups.
+
2008-03-09 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
* invoke.texi (Error and Warning Options): Document
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index e9303a4..bc45e9e 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -2310,6 +2310,12 @@ mio_symtree_ref (gfc_symtree **stp)
p->u.rsym.symtree->n.sym = p->u.rsym.sym;
p->u.rsym.symtree->n.sym->refs++;
p->u.rsym.referenced = 1;
+
+ /* If the symbol is PRIVATE and in COMMON, load_commons will
+ generate a fixup symbol, which must be associated. */
+ if (p->fixup)
+ resolve_fixups (p->fixup, p->u.rsym.sym);
+ p->fixup = NULL;
}
if (p->type == P_UNKNOWN)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ee2790b..5db1398 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-09 Paul Thomas <pault@gcc.gnu.org>
+
+ PR fortran/35474
+ * gfortran.dg/module_commons_2.f90: New test.
+
2008-03-09 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/frame_overflow.adb: Improve portability.
diff --git a/gcc/testsuite/gfortran.dg/module_commons_2.f90 b/gcc/testsuite/gfortran.dg/module_commons_2.f90
new file mode 100644
index 0000000..3c3214c
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/module_commons_2.f90
@@ -0,0 +1,21 @@
+! { dg-do compile }
+! Tests the fix for PR35474, in which the PRIVATE statement would
+! cause the error Internal Error at (1): free_pi_tree(): Unresolved fixup
+! This arose because the symbol for 'i' emanating from the COMMON was
+! not being fixed-up as the EQUIVALENCE was built.
+!
+! Contributed by FX Coudert <fxcoudert@gcc.gnu.org>
+!
+module h5global
+ integer i
+ integer j
+ common /c/ i
+ equivalence (i, j)
+ private
+end module h5global
+
+program bug
+ use h5global
+end
+
+! { dg-final { cleanup-modules "h5global" } }