diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-15 15:01:33 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-15 15:01:33 +0000 |
commit | 0a3b59126cc532673941ff1718249524ae20ef73 (patch) | |
tree | 89980c834807b5a0b0482e3062763d600f60c4c7 /gcc/fold-const.c | |
parent | 713b2724897bda447e5360278f915c2cf927c29a (diff) | |
download | ppe42-gcc-0a3b59126cc532673941ff1718249524ae20ef73.tar.gz ppe42-gcc-0a3b59126cc532673941ff1718249524ae20ef73.zip |
2011-08-15 Richard Guenther <rguenther@suse.de>
PR middle-end/50082
* fold-const.c (maybe_canonicalize_comparison_1): Properly
convert the modified operand to the other operand type.
(fold_comparison): Call maybe_canonicalize_comparison_1 with
useless conversions stripped from comparison operands.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177762 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6abce5924e9..9c389ccfe3e 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8446,6 +8446,7 @@ maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type, cst0, build_int_cst (TREE_TYPE (cst0), 1)); if (code0 != INTEGER_CST) t = fold_build2_loc (loc, code0, TREE_TYPE (arg0), TREE_OPERAND (arg0, 0), t); + t = fold_convert (TREE_TYPE (arg1), t); /* If swapping might yield to a more canonical form, do so. */ if (swap) @@ -8935,7 +8936,7 @@ fold_comparison (location_t loc, enum tree_code code, tree type, return fold_build2_loc (loc, cmp_code, type, variable1, const2); } - tem = maybe_canonicalize_comparison (loc, code, type, op0, op1); + tem = maybe_canonicalize_comparison (loc, code, type, arg0, arg1); if (tem) return tem; |