--- Comment #8 from burnus at gcc dot gnu dot org 2010-07-26 09:42 ---
(In reply to comment #2)
--- trans-io.c (revision 162507)
+++ trans-io.c (working copy)
+ if (base_addr == NULL)
+return;
+
This does not make sense if you call transfer_namelist_element in build_dt with
the arguments:
transfer_namelist_element (block, nml-sym-name, nml-sym,
NULL, NULL);
The last argument is tree base_addr. (By the way, I think that should be
NULL_TREE and not NULL.)
Besides, the issue seems to be rather:
dt = TREE_TYPE ((sym) ? sym-backend_decl : c-backend_decl);
dtype = gfc_get_dtype (dt);
which makes more sense in terms of fwhole-file; the problem is that
sym-backend_decl = NULL.
It seems as if the following patch fixes this. With -fno-whole-file the
sym-backend_decl is set and one returns the decl. With -fwhole-file only the
decl was returned.
I wonder how many other issues this patch fixes.
Note: I tested it for the example in comment 0, but I have not yet tested it
against gfortran's test suite.
Index: trans-io.c
===
--- trans-io.c (revision 162526)
+++ 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: trans-decl.c
===
--- trans-decl.c(revision 162526)
+++ 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;
}
}
}
--
burnus at gcc dot gnu dot org changed:
What|Removed |Added
CC||burnus at gcc dot gnu dot
||org
AssignedTo|unassigned at gcc dot gnu |burnus at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2010-07-25 14:26:17 |2010-07-26 09:42:10
date||
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45066