diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2007-07-29 14:44:03 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-07-29 14:44:03 +0000 |
commit | 6a56381bf7e8825e08ec3a47bc14230528c82462 (patch) | |
tree | b1baf655fd48fd016a7f4e4a7691ae4277de5174 /gcc/fortran/trans-array.c | |
parent | c317bc4076ec88beb910e6cdf0fcd067035361fb (diff) | |
download | gcc-6a56381bf7e8825e08ec3a47bc14230528c82462.zip gcc-6a56381bf7e8825e08ec3a47bc14230528c82462.tar.gz gcc-6a56381bf7e8825e08ec3a47bc14230528c82462.tar.bz2 |
re PR fortran/31211 (wrong code generated for pointer returning function as actual argument)
2007-07-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31211
* trans-expr.c (gfc_conv_expr_reference): Add block for case of
scalar pointer functions so that NULL result is correctly
handled.
PR fortran/32682
*trans-array.c (gfc_trans_array_constructor): On detecting a
multi-dimensional parameter array, set the loop limits.
2007-07-29 Paul Thomas <pault@gcc.gnu.org>
PR fortran/31211
* gfortran.dg/actual_pointer_function_1.f90: New test.
PR fortran/32682
* gfortran.dg/scalarize_parameter_array_1.f90: New test.
From-SVN: r127044
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 16f9577..63a1ea0 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -1656,6 +1656,21 @@ gfc_trans_array_constructor (gfc_loopinfo * loop, gfc_ss * ss) /* See if the constructor determines the loop bounds. */ dynamic = false; + + if (ss->expr->shape && loop->dimen > 1 && loop->to[0] == NULL_TREE) + { + /* We have a multidimensional parameter. */ + int n; + for (n = 0; n < ss->expr->rank; n++) + { + loop->from[n] = gfc_index_zero_node; + loop->to[n] = gfc_conv_mpz_to_tree (ss->expr->shape [n], + gfc_index_integer_kind); + loop->to[n] = fold_build2 (MINUS_EXPR, gfc_array_index_type, + loop->to[n], gfc_index_one_node); + } + } + if (loop->to[0] == NULL_TREE) { mpz_t size; |