aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2011-10-09 13:34:21 +0200
committerJanus Weil <janus@gcc.gnu.org>2011-10-09 13:34:21 +0200
commit4e5d3db2c4ceca99cbeaeca30080c3825ddcceef (patch)
treea4cb2cad23bc8f683ad7e55d3f8a62e700215779 /gcc/fortran/expr.c
parent3bb4db675ad3ca37d41664938f93db86ec577e7b (diff)
downloadgcc-4e5d3db2c4ceca99cbeaeca30080c3825ddcceef.zip
gcc-4e5d3db2c4ceca99cbeaeca30080c3825ddcceef.tar.gz
gcc-4e5d3db2c4ceca99cbeaeca30080c3825ddcceef.tar.bz2
re PR fortran/50659 ([F03] ICE with PROCEDURE statement)
2011-10-09 Janus Weil <janus@gcc.gnu.org> PR fortran/50659 * expr.c (replace_symbol): Only do replacement if the symbol is a dummy. 2011-10-09 Janus Weil <janus@gcc.gnu.org> PR fortran/50659 * gfortran.dg/proc_decl_27.f90: New. From-SVN: r179723
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 397dcdc..8a09a28 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -4134,8 +4134,9 @@ gfc_expr_check_typed (gfc_expr* e, gfc_namespace* ns, bool strict)
return error_found ? FAILURE : SUCCESS;
}
-/* Walk an expression tree and replace all symbols with a corresponding symbol
- in the formal_ns of "sym". Needed for copying interfaces in PROCEDURE
+
+/* Walk an expression tree and replace all dummy symbols by the corresponding
+ symbol in the formal_ns of "sym". Needed for copying interfaces in PROCEDURE
statements. The boolean return value is required by gfc_traverse_expr. */
static bool
@@ -4144,14 +4145,12 @@ replace_symbol (gfc_expr *expr, gfc_symbol *sym, int *i ATTRIBUTE_UNUSED)
if ((expr->expr_type == EXPR_VARIABLE
|| (expr->expr_type == EXPR_FUNCTION
&& !gfc_is_intrinsic (expr->symtree->n.sym, 0, expr->where)))
- && expr->symtree->n.sym->ns == sym->ts.interface->formal_ns)
+ && expr->symtree->n.sym->ns == sym->ts.interface->formal_ns
+ && expr->symtree->n.sym->attr.dummy)
{
- gfc_symtree *stree;
- gfc_namespace *ns = sym->formal_ns;
- /* Don't use gfc_get_symtree as we prefer to fail badly if we don't find
- the symtree rather than create a new one (and probably fail later). */
- stree = gfc_find_symtree (ns ? ns->sym_root : gfc_current_ns->sym_root,
- expr->symtree->n.sym->name);
+ gfc_symtree *root = sym->formal_ns ? sym->formal_ns->sym_root
+ : gfc_current_ns->sym_root;
+ gfc_symtree *stree = gfc_find_symtree (root, expr->symtree->n.sym->name);
gcc_assert (stree);
stree->n.sym->attr = expr->symtree->n.sym->attr;
expr->symtree = stree;
@@ -4165,6 +4164,7 @@ gfc_expr_replace_symbols (gfc_expr *expr, gfc_symbol *dest)
gfc_traverse_expr (expr, dest, &replace_symbol, 0);
}
+
/* The following is analogous to 'replace_symbol', and needed for copying
interfaces for procedure pointer components. The argument 'sym' must formally
be a gfc_symbol, so that the function can be passed to gfc_traverse_expr.