aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorMikael Morin <mikael.morin@tele2.fr>2008-11-25 14:27:26 +0100
committerMikael Morin <mikael@gcc.gnu.org>2008-11-25 13:27:26 +0000
commitbc0f8bd47860ef185442971eb3e5cea226962ef5 (patch)
tree4731d54804dc0b9fe0fc75c8c985166a91c4f7b8 /gcc/fortran
parent056c165212dafd1e959042bfac11509eb0e187d7 (diff)
downloadgcc-bc0f8bd47860ef185442971eb3e5cea226962ef5.zip
gcc-bc0f8bd47860ef185442971eb3e5cea226962ef5.tar.gz
gcc-bc0f8bd47860ef185442971eb3e5cea226962ef5.tar.bz2
re PR fortran/36463 (gfc_get_default_type(): Bad symbol)
2008-11-25 Mikael Morin <mikael.morin@tele2.fr> PR fortran/36463 * expr.c (replace_symbol): Don't replace the symtree if the expresion is an intrinsic function. Don't create non-existent symtrees. Use symbol's name instead of symtree's, different in case of module procedure dummy arguments. 2008-11-25 Mikael Morin <mikael.morin@tele2.fr> PR fortran/36463 * gfortran.dg/proc_decl_20.f90: New test. From-SVN: r142191
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog8
-rw-r--r--gcc/fortran/expr.c11
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index a75f983..b22c8da 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-25 Mikael Morin <mikael.morin@tele2.fr>
+
+ PR fortran/36463
+ * expr.c (replace_symbol): Don't replace the symtree
+ if the expresion is an intrinsic function. Don't create
+ non-existent symtrees. Use symbol's name instead of symtree's,
+ different in case of module procedure dummy arguments.
+
2008-11-25 Jan Kratochvil <jan.kratochvil@redhat.com>
PR fortran/38248
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index ea76653..4017cf9 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3510,11 +3510,18 @@ gfc_expr_check_typed (gfc_expr* e, gfc_namespace* ns, bool strict)
static bool
replace_symbol (gfc_expr *expr, gfc_symbol *sym, int *i ATTRIBUTE_UNUSED)
{
- if ((expr->expr_type == EXPR_VARIABLE || expr->expr_type == EXPR_FUNCTION)
+ 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)
{
gfc_symtree *stree;
- gfc_get_sym_tree (expr->symtree->name, sym->formal_ns, &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);
+ gcc_assert (stree);
stree->n.sym->attr = expr->symtree->n.sym->attr;
expr->symtree = stree;
}