re PR fortran/35474 (Reading module file with COMMON and EQUIVALENCE)
authorPaul Thomas <pault@gcc.gnu.org>
Sun, 9 Mar 2008 19:38:51 +0000 (19:38 +0000)
committerPaul Thomas <pault@gcc.gnu.org>
Sun, 9 Mar 2008 19:38:51 +0000 (19:38 +0000)
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

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

index 72bf5129c44718927923af4488d6b3187d028b4c..e660d9cd8fff76414d86eda4f14f45696b8e7418 100644 (file)
@@ -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
index e9303a4f367aeb3c6c1780290dc479e6a9d317b1..bc45e9eb9c14315571458d9c78086b163b7e4282 100644 (file)
@@ -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)
index ee2790b514139e29f3643da9cd92b9efcc461eb8..5db1398385576216fb2fd9a1d7b188851b63315c 100644 (file)
@@ -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 (file)
index 0000000..3c3214c
--- /dev/null
@@ -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" } }