diff options
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r-- | gcc/fortran/primary.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 902279c..653df5d 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -2062,17 +2062,16 @@ gfc_match_rvalue (gfc_expr **result) gfc_gobble_whitespace (); if (sym->attr.recursive && gfc_peek_char () == '(' - && gfc_current_ns->proc_name == sym) + && gfc_current_ns->proc_name == sym + && !sym->attr.dimension) { - if (!sym->attr.dimension) - goto function0; - - gfc_error ("'%s' is array valued and directly recursive " - "at %C , so the keyword RESULT must be specified " - "in the FUNCTION statement", sym->name); + gfc_error ("'%s' at %C is the name of a recursive function " + "and so refers to the result variable. Use an " + "explicit RESULT variable for direct recursion " + "(12.5.2.1)", sym->name); return MATCH_ERROR; } - + if (gfc_current_ns->proc_name == sym || (gfc_current_ns->parent != NULL && gfc_current_ns->parent->proc_name == sym)) |