diff options
author | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-14 19:30:42 +0000 |
---|---|---|
committer | ktietz <ktietz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-10-14 19:30:42 +0000 |
commit | 08fc122d46935bdfbb96c902ed92afb6198f3275 (patch) | |
tree | 698b6ce8800d81c73e13932058f99a12e5693a1b /gcc/gimplify.c | |
parent | 16e84e52a0e2fff53566d3526e1471f44f7cb0de (diff) | |
download | gcc-08fc122d46935bdfbb96c902ed92afb6198f3275.tar.gz |
* gimplify.c (gimplify_expr): Take care that for bitwise-binary
transformation the operands have compatible types.
* gfortran.fortran-torture/compile/logical-2.f90: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180006 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2c9ba1d78aa..8c2c5ac2c9c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7256,8 +7256,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, case TRUTH_XOR_EXPR: { tree orig_type = TREE_TYPE (*expr_p); + tree new_type, xop0, xop1; *expr_p = gimple_boolify (*expr_p); - if (!useless_type_conversion_p (orig_type, TREE_TYPE (*expr_p))) + new_type = TREE_TYPE (*expr_p); + if (!useless_type_conversion_p (orig_type, new_type)) { *expr_p = fold_convert_loc (input_location, orig_type, *expr_p); ret = GS_OK; @@ -7281,7 +7283,18 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, default: break; } - + /* Now make sure that operands have compatible type to + expression's new_type. */ + xop0 = TREE_OPERAND (*expr_p, 0); + xop1 = TREE_OPERAND (*expr_p, 1); + if (!useless_type_conversion_p (new_type, TREE_TYPE (xop0))) + TREE_OPERAND (*expr_p, 0) = fold_convert_loc (input_location, + new_type, + xop0); + if (!useless_type_conversion_p (new_type, TREE_TYPE (xop1))) + TREE_OPERAND (*expr_p, 1) = fold_convert_loc (input_location, + new_type, + xop1); /* Continue classified as tcc_binary. */ goto expr_2; } |