diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/primary.c | 15 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7e98c46..7f80e37 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,12 @@ 2006-05-21 Paul Thomas <pault@gcc.gnu.org> + PR fortran/27613 + * primary.c (gfc_match_rvalue): Test if symbol represents a + direct recursive function reference. Error if array valued, + go to function0 otherwise. + +2006-05-21 Paul Thomas <pault@gcc.gnu.org> + PR fortran/25746 * interface.c (gfc_extend_assign): Use new EXEC_ASSIGN_CALL. * gfortran.h : Put EXEC_ASSIGN_CALL in enum. diff --git a/gcc/fortran/primary.c b/gcc/fortran/primary.c index 56cff2c..967bcb0 100644 --- a/gcc/fortran/primary.c +++ b/gcc/fortran/primary.c @@ -1933,6 +1933,21 @@ gfc_match_rvalue (gfc_expr ** result) if (sym->attr.function && sym->result == sym) { + /* See if this is a directly recursive function call. */ + gfc_gobble_whitespace (); + if (sym->attr.recursive + && gfc_peek_char () == '(' + && gfc_current_ns->proc_name == sym) + { + 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); + return MATCH_ERROR; + } + if (gfc_current_ns->proc_name == sym || (gfc_current_ns->parent != NULL && gfc_current_ns->parent->proc_name == sym)) |