diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2016-02-05 21:41:15 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2016-02-05 21:41:15 +0000 |
commit | 711d7c231fc6a5a04f65568cf17a47c270527a09 (patch) | |
tree | 6b50b567f3e7b484d1a22fbe37c2dcf74d0ad824 /gcc/fortran/trans.h | |
parent | 861c7bcd62bcbbf6e14311e18ba7293cc581e1ff (diff) | |
download | gcc-711d7c231fc6a5a04f65568cf17a47c270527a09.zip gcc-711d7c231fc6a5a04f65568cf17a47c270527a09.tar.gz gcc-711d7c231fc6a5a04f65568cf17a47c270527a09.tar.bz2 |
Fix fortran scalar elemental dependency mishandling
PR fortran/66089
gcc/fortran/
* trans-expr.c (expr_is_variable, gfc_expr_is_variable): Rename
the former to the latter and make it non-static. Update callers.
* gfortran.h (gfc_expr_is_variable): New declaration.
(struct gfc_ss_info): Add field needs_temporary.
* trans-array.c (gfc_scalar_elemental_arg_saved_as_argument):
Tighten the condition on aggregate expressions with a check
that the expression is a variable and doesn't need a temporary.
(gfc_conv_resolve_dependency): Add intermediary reference variable.
Set the needs_temporary field.
gcc/testsuite/
* gfortran.dg/elemental_dependency_6.f90: New.
From-SVN: r233188
Diffstat (limited to 'gcc/fortran/trans.h')
-rw-r--r-- | gcc/fortran/trans.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 3026e3b..316ee9b 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -210,6 +210,10 @@ typedef struct gfc_ss_info this is the symbol of the corresponding dummy argument. */ gfc_symbol *dummy_arg; tree value; + /* Tells that the scalar is a reference to a variable that might + be present on the lhs, so that we should evaluate the value + itself before the loop, not just the reference. */ + unsigned needs_temporary:1; } scalar; @@ -464,6 +468,7 @@ bool gfc_conv_ieee_arithmetic_function (gfc_se *, gfc_expr *); tree gfc_save_fp_state (stmtblock_t *); void gfc_restore_fp_state (stmtblock_t *, tree); +bool gfc_expr_is_variable (gfc_expr *); /* Does an intrinsic map directly to an external library call This is true for array-returning intrinsics, unless |