diff options
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index dae2149..3d519db 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4371,15 +4371,26 @@ gfc_build_intrinsic_call (const char* name, locus where, unsigned numarg, ...) gfc_try gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context) { - gfc_symbol* sym; + gfc_symbol* sym = NULL; bool is_pointer; bool check_intentin; bool ptr_component; symbol_attribute attr; gfc_ref* ref; + if (e->expr_type == EXPR_VARIABLE) + { + gcc_assert (e->symtree); + sym = e->symtree->n.sym; + } + else if (e->expr_type == EXPR_FUNCTION) + { + gcc_assert (e->symtree); + sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; + } + if (!pointer && e->expr_type == EXPR_FUNCTION - && e->symtree->n.sym->result->attr.pointer) + && sym->result->attr.pointer) { if (!(gfc_option.allow_std & GFC_STD_F2008)) { @@ -4397,9 +4408,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, const char* context) return FAILURE; } - gcc_assert (e->symtree); - sym = e->symtree->n.sym; - if (!pointer && sym->attr.flavor == FL_PARAMETER) { if (context) |