diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 11:46:47 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-05-11 11:46:47 +0000 |
commit | fc2d8680dde7cdf9a19f0007a3a2ae49c7e0aa36 (patch) | |
tree | 954562f2de3bc196c47fcd9c848c6f563adc96a0 /gcc/fortran/trans-expr.c | |
parent | 847b053dd214c6e26a2025bf29422457cb50143d (diff) | |
download | gcc-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/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 182ec19..239e41e 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -2317,7 +2317,17 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, if (byref) { if (se->direct_byref) - retargs = gfc_chainon_list (retargs, se->expr); + { + /* Sometimes, too much indirection can be applied; eg. for + function_result = array_valued_recursive_function. */ + if (TREE_TYPE (TREE_TYPE (se->expr)) + && TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))) + && GFC_DESCRIPTOR_TYPE_P + (TREE_TYPE (TREE_TYPE (TREE_TYPE (se->expr))))) + se->expr = build_fold_indirect_ref (se->expr); + + retargs = gfc_chainon_list (retargs, se->expr); + } else if (sym->result->attr.dimension) { gcc_assert (se->loop && info); |