aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/primary.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2007-05-11 11:46:47 +0000
committerPaul Thomas <pault@gcc.gnu.org>2007-05-11 11:46:47 +0000
commitfc2d8680dde7cdf9a19f0007a3a2ae49c7e0aa36 (patch)
tree954562f2de3bc196c47fcd9c848c6f563adc96a0 /gcc/fortran/primary.c
parent847b053dd214c6e26a2025bf29422457cb50143d (diff)
downloadgcc-fc2d8680dde7cdf9a19f0007a3a2ae49c7e0aa36.zip
gcc-fc2d8680dde7cdf9a19f0007a3a2ae49c7e0aa36.tar.gz
gcc-fc2d8680dde7cdf9a19f0007a3a2ae49c7e0aa36.tar.bz2
re PR fortran/30876 (Array valued recursive function rejected)
2007-05-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30876 * trans-expr.c (gfc_conv_function_call): Reduce indirection for direct assignments of recursive array valued functions. * primary.c (gfc_match_rvalue): Correct error for recursive function calls such that directly recursive calls of scalar function without an explicit result are disallowed. 2007-05-11 Paul Thomas <pault@gcc.gnu.org> PR fortran/30876 * gfortran.dg/recursive_reference_1.f90: Put error at correct line. * gfortran.dg/recursive_reference_2.f90: New test. From-SVN: r124616
Diffstat (limited to 'gcc/fortran/primary.c')
-rw-r--r--gcc/fortran/primary.c15
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))