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/primary.c | |
| 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/primary.c')
| -rw-r--r-- | gcc/fortran/primary.c | 15 |
1 files changed, 15 insertions, 0 deletions
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)) |
