diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-05-21 11:53:02 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-05-21 11:53:02 +0000 |
commit | 811849c027531923175a35b52eecce0368d36a2e (patch) | |
tree | 4171568da927dcd7eb831eb7f19bfd1b5b93c3d1 /gcc/fortran | |
parent | 13dbe6919072573e939fe5b693d2d6f052af3b12 (diff) | |
download | gcc-811849c027531923175a35b52eecce0368d36a2e.zip gcc-811849c027531923175a35b52eecce0368d36a2e.tar.gz gcc-811849c027531923175a35b52eecce0368d36a2e.tar.bz2 |
re PR fortran/27613 (compile fails with "Unclassifiable statement" error message)
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/27613
* gfortran.dg/recursive_reference_1.f90: New test.
From-SVN: r113951
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)) |