This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gfortran] Boolean type cleanups.
- From: Paul Brook <paul at nowt dot org>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>,fortran at gcc dot gnu dot org
- Date: Mon, 20 Oct 2003 15:44:38 +0100
- Subject: [gfortran] Boolean type cleanups.
Patch fixes a couple of inconsisencies I spotted in our use of boolean
types/operators.
Applied to tree-ssa branch.
Paul
2003-10-20 Paul Brook <paul@nowt.org>
* trans-expr.c (gfc_conv_integer_power): Use boolean_type_node.
* trans-stmt.c (gfc_trans_do_while): Ditto.
--- clean/tree-ssa/gcc/fortran/trans-expr.c
+++ gcc/gcc/fortran/trans-expr.c
@@ -525,10 +525,10 @@ gfc_conv_integer_power (gfc_se * se, tre
tmp = gfc_finish_block (&block);
/* Select the appropriate action. */
- cond = build (EQ_EXPR, TREE_TYPE (rhs), rhs, integer_zero_node);
+ cond = build (EQ_EXPR, boolean_type_node, rhs, integer_zero_node);
tmp = build_v (COND_EXPR, cond, tmp, neg_stmt);
- cond = build (GT_EXPR, TREE_TYPE (rhs), rhs, integer_zero_node);
+ cond = build (GT_EXPR, boolean_type_node, rhs, integer_zero_node);
tmp = build_v (COND_EXPR, cond, pos_stmt, tmp);
gfc_add_expr_to_block (&se->pre, tmp);
}
--- clean/tree-ssa/gcc/fortran/trans-stmt.c
+++ gcc/gcc/fortran/trans-stmt.c
@@ -559,8 +559,7 @@ gfc_trans_do_while (gfc_code * code)
gfc_init_se (&cond, NULL);
gfc_conv_expr_val (&cond, code->expr);
gfc_add_block_to_block (&block, &cond.pre);
- cond.expr = build (EQ_EXPR, TREE_TYPE (cond.expr), cond.expr,
- integer_zero_node);
+ cond.expr = fold (build1 (TRUTH_NOT_EXPR, boolean_type_node, cond.expr));
/* Build "IF (! cond) GOTO exit_label". */
tmp = build1_v (GOTO_EXPR, exit_label);