aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMikael Morin <mikael@gcc.gnu.org>2010-09-10 13:03:06 +0000
committerMikael Morin <mikael@gcc.gnu.org>2010-09-10 13:03:06 +0000
commit0ae6242fedfb4a4f7ac0f6e72ebd3788715e1cb2 (patch)
treeff25399536bfae033545afa7e8e3e5b5c30977c9 /gcc
parenta5ad78bbcd97ca09a79505b06582824c09cdf8da (diff)
downloadgcc-0ae6242fedfb4a4f7ac0f6e72ebd3788715e1cb2.zip
gcc-0ae6242fedfb4a4f7ac0f6e72ebd3788715e1cb2.tar.gz
gcc-0ae6242fedfb4a4f7ac0f6e72ebd3788715e1cb2.tar.bz2
trans-expr.c (expr_is_variable): New function taking non-copying intrinsic functions into account.
2010-09-10 Mikael Morin <mikael@gcc.gnu.org> * trans-expr.c (expr_is_variable): New function taking non-copying intrinsic functions into account. (gfc_trans_assignment_1): Use expr_is_variable. From-SVN: r164169
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/trans-expr.c27
2 files changed, 30 insertions, 3 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 8c70828..71d7c9e 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,5 +1,11 @@
2010-09-10 Mikael Morin <mikael@gcc.gnu.org>
+ * trans-expr.c (expr_is_variable): New function taking non-copying
+ intrinsic functions into account.
+ (gfc_trans_assignment_1): Use expr_is_variable.
+
+2010-09-10 Mikael Morin <mikael@gcc.gnu.org>
+
* trans-array.c (gfc_conv_loop_setup): Access the shape along the
real array dimension instead of the scalarizer (loop) dimension.
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c
index db1686b..8d4295f 100644
--- a/gcc/fortran/trans-expr.c
+++ b/gcc/fortran/trans-expr.c
@@ -5536,6 +5536,27 @@ gfc_trans_array_constructor_copy (gfc_expr * expr1, gfc_expr * expr2)
}
+/* Tells whether the expression is to be treated as a variable reference. */
+
+static bool
+expr_is_variable (gfc_expr *expr)
+{
+ gfc_expr *arg;
+
+ if (expr->expr_type == EXPR_VARIABLE)
+ return true;
+
+ arg = gfc_get_noncopying_intrinsic_argument (expr);
+ if (arg)
+ {
+ gcc_assert (expr->value.function.isym->id == GFC_ISYM_TRANSPOSE);
+ return expr_is_variable (arg);
+ }
+
+ return false;
+}
+
+
/* Subroutine of gfc_trans_assignment that actually scalarizes the
assignment. EXPR1 is the destination/LHS and EXPR2 is the source/RHS.
init_flag indicates initialization expressions and dealloc that no
@@ -5661,7 +5682,7 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
must have its components deallocated afterwards. */
scalar_to_array = (expr2->ts.type == BT_DERIVED
&& expr2->ts.u.derived->attr.alloc_comp
- && expr2->expr_type != EXPR_VARIABLE
+ && !expr_is_variable (expr2)
&& !gfc_is_constant_expr (expr2)
&& expr1->rank && !expr2->rank);
if (scalar_to_array && dealloc)
@@ -5672,8 +5693,8 @@ gfc_trans_assignment_1 (gfc_expr * expr1, gfc_expr * expr2, bool init_flag,
tmp = gfc_trans_scalar_assign (&lse, &rse, expr1->ts,
l_is_temp || init_flag,
- (expr2->expr_type == EXPR_VARIABLE)
- || scalar_to_array, dealloc);
+ expr_is_variable (expr2) || scalar_to_array,
+ dealloc);
gfc_add_expr_to_block (&body, tmp);
if (lss == gfc_ss_terminator)