]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/50082 (-Wstrict-overflow mishandles typedef)
authorRichard Guenther <rguenther@suse.de>
Mon, 15 Aug 2011 15:01:33 +0000 (15:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 15 Aug 2011 15:01:33 +0000 (15:01 +0000)
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.

From-SVN: r177762

gcc/ChangeLog
gcc/fold-const.c

index de1298c4fb4006f792407a80116d1d76fa1f02ac..952310748c04e0baa3f6770f6d6d1cbd9ec5f72c 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2011-08-15  Richard Guenther  <rguenther@suse.de>
 
        * tree-vrp.c (value_range_nonnegative_p): Fix anti-range case.
index 6abce5924e91db0d6591aa3d5af28e82532d17ca..9c389ccfe3e42ae0e2d7f9de0e44d45f3e88d181 100644 (file)
@@ -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;