diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 11:42:56 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 11:42:56 +0000 |
commit | 847b053dd214c6e26a2025bf29422457cb50143d (patch) | |
tree | eb28e776bc0b0ddb2c8cd9a8a1ef194444373808 /gcc/fortran/trans-io.c | |
parent | 35dd9a0e6d9491ee708c2d75ecf8d74aa40cbb39 (diff) | |
download | gcc-847b053dd214c6e26a2025bf29422457cb50143d.zip gcc-847b053dd214c6e26a2025bf29422457cb50143d.tar.gz gcc-847b053dd214c6e26a2025bf29422457cb50143d.tar.bz2 |
re PR fortran/30878 (Rejects function f1; namelist /nml/ f1)
2007-05-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30878
* resolve.c (resolve_fl_namelist): It is not an error if the
namelist element is the result variable of the enclosing
function. Search for the symbol in current and all parent
namespaces for a potential conflict.
* symbol.c (check_conflict): Remove the conflict between
'in_namelist' and 'FL_PROCEDURE' because the symbol info
is not available to exclude function result variables.
* trans-io.c (nml_get_addr_expr): Use the fake result decl
if the symbol is an implicit result variable.
2007-05-11 Paul Thomas <pault@gcc.gnu.org>
PR fortran/30878
* gfortran.dg/namelist_29.f90: New test.
From-SVN: r124615
Diffstat (limited to 'gcc/fortran/trans-io.c')
-rw-r--r-- | gcc/fortran/trans-io.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 4b87bcb..e543f4c 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -1297,6 +1297,13 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c, { sym->attr.referenced = 1; decl = gfc_get_symbol_decl (sym); + + /* If this is the enclosing function declaration, use + the fake result instead. */ + if (decl == current_function_decl) + decl = gfc_get_fake_result_decl (sym, 0); + else if (decl == DECL_CONTEXT (current_function_decl)) + decl = gfc_get_fake_result_decl (sym, 1); } else decl = c->backend_decl; |