diff options
author | Richard Guenther <rguenther@suse.de> | 2008-02-21 09:38:07 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-02-21 09:38:07 +0000 |
commit | dedd42d511b6e49303a8da3f62486567122c5fc4 (patch) | |
tree | 9acaddca083fdd255ba2f0c1f7b3920dd211da9d /gcc/fortran/trans-expr.c | |
parent | 163b0163e6197a4209b7087d580bf5b8ed51700d (diff) | |
download | gcc-dedd42d511b6e49303a8da3f62486567122c5fc4.zip gcc-dedd42d511b6e49303a8da3f62486567122c5fc4.tar.gz gcc-dedd42d511b6e49303a8da3f62486567122c5fc4.tar.bz2 |
tree.def (PAREN_EXPR): New tree code.
2008-02-21 Richard Guenther <rguenther@suse.de>
* tree.def (PAREN_EXPR): New tree code.
* fold-const.c (fold_unary): Remove PAREN_EXPR around constants
and PAREN_EXPR.
* tree-pretty-print.c (dump_generic_node): Handle PAREN_EXPR.
* expr.c (expand_expr_real_1): Likewise.
* tree-inline.c (estimate_num_insns_1): Likewise.
* tree-complex.c (expand_complex_move): Likewise.
* tree-vectorizer.c (vect_is_simple_use): Treat PAREN_EXPR (x)
as plain x.
* trans-expr.c (gfc_conv_expr_op): Expand INTRINSIC_PARENTHESES
as unary PAREN_EXPR for real and complex typed expressions.
(gfc_conv_unary_op): Fold the built tree.
* gfortran.dg/reassoc_1.f90: New testcase.
* gfortran.dg/reassoc_2.f90: Likewise.
* gfortran.dg/reassoc_3.f90: Likewise.
From-SVN: r132515
Diffstat (limited to 'gcc/fortran/trans-expr.c')
-rw-r--r-- | gcc/fortran/trans-expr.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 4866d8c..8d0392f 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -607,10 +607,10 @@ gfc_conv_unary_op (enum tree_code code, gfc_se * se, gfc_expr * expr) We must convert it to a compare to 0 (e.g. EQ_EXPR (op1, 0)). All other unary operators have an equivalent GIMPLE unary operator. */ if (code == TRUTH_NOT_EXPR) - se->expr = build2 (EQ_EXPR, type, operand.expr, - build_int_cst (type, 0)); + se->expr = fold_build2 (EQ_EXPR, type, operand.expr, + build_int_cst (type, 0)); else - se->expr = build1 (code, type, operand.expr); + se->expr = fold_build1 (code, type, operand.expr); } @@ -1071,8 +1071,17 @@ gfc_conv_expr_op (gfc_se * se, gfc_expr * expr) lop = 0; switch (expr->value.op.operator) { - case INTRINSIC_UPLUS: case INTRINSIC_PARENTHESES: + if (expr->ts.type == BT_REAL + || expr->ts.type == BT_COMPLEX) + { + gfc_conv_unary_op (PAREN_EXPR, se, expr); + gcc_assert (FLOAT_TYPE_P (TREE_TYPE (se->expr))); + return; + } + + /* Fallthrough. */ + case INTRINSIC_UPLUS: gfc_conv_expr (se, expr->value.op.op1); return; |