This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Patch, Fortran, committed] PR 40011 - Regression with namelist and -fwhole-file
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc patches <gcc-patches at gcc dot gnu dot org>, gfortran <fortran at gcc dot gnu dot org>
- Date: Mon, 26 Jul 2010 12:31:18 +0200
- Subject: [Patch, Fortran, committed] PR 40011 - Regression with namelist and -fwhole-file
The patch is obvious: Without whole-file, gfc_get_symbol_decl returns
the decl *and* sets sym->backend_decl -- without whole-file, the latter
was not done.
Build and regtested on x86-64-linux.
Committed as Rev. 162532.
Tobias
2010-07-26 Tobias Burnus <burnus@net-b.de>
PR fortran/45066
* trans-io.c (build_dt): Use NULL_TREE rather than NULL
for call to transfer_namelist_element.
* trans-decl.c (gfc_get_symbol_decl): Also set sym->backend_decl
for -fwhole-file.
2010-07-26 Tobias Burnus <burnus@net-b.de>
PR fortran/45066
* gfortran.dg/namelist_62.f90: New.
Index: gcc/testsuite/gfortran.dg/namelist_62.f90
===================================================================
--- gcc/testsuite/gfortran.dg/namelist_62.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/namelist_62.f90 (revision 0)
@@ -0,0 +1,20 @@
+! { dg-do compile }
+!
+! PR fortran/45066
+!
+! Contributed by Michael Richmond.
+!
+! Was failing due to a -fwhole-file bug.
+!
+
+MODULE GA_commons
+ INTEGER :: nichflg(2)
+END MODULE GA_commons
+
+PROGRAM gafortran
+ USE GA_commons
+ NAMELIST /ga/ nichflg
+ READ (23, nml=ga)
+END PROGRAM gafortran
+
+! { dg-final { cleanup-modules "ga_commons" } }
Index: gcc/fortran/trans-io.c
===================================================================
--- gcc/fortran/trans-io.c (revision 162526)
+++ gcc/fortran/trans-io.c (working copy)
@@ -1760,7 +1760,7 @@ build_dt (tree function, gfc_code * code
for (nml = dt->namelist->namelist; nml; nml = nml->next)
transfer_namelist_element (&block, nml->sym->name, nml->sym,
- NULL, NULL);
+ NULL, NULL_TREE);
}
else
set_parameter_const (&block, var, IOPARM_common_flags, mask);
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c (revision 162526)
+++ gcc/fortran/trans-decl.c (working copy)
@@ -1150,7 +1150,8 @@ gfc_get_symbol_decl (gfc_symbol * sym)
true);
if (sym->ts.type == BT_CHARACTER)
sym->ts.u.cl->backend_decl = s->ts.u.cl->backend_decl;
- return s->backend_decl;
+ sym->backend_decl = s->backend_decl;
+ return sym->backend_decl;
}
}
}