This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix copy&paste error in fold
- From: Richard Biener <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Oct 2014 15:42:20 +0200 (CEST)
- Subject: [PATCH] Fix copy&paste error in fold
- Authentication-results: sourceware.org; auth=none
The following makes sure to convert the correct argument, not the
one we already converted. Currently we end up folding
ptr-type - integer-type. Oops. Fails spectacularly on
match-and-simplify where this is the first strip-nops
missed-optimization (on bogus input, that is).
I'm considering this is obvious but will include it in a bootstrap/regtest
anyway.
Thanks,
Richard.
2014-10-23 Richard Biener <rguenther@suse.de>
* fold-const.c (fold_binary_loc): Fix copy-and-pasto.
Index: gcc/fold-const.c
===================================================================
--- gcc/fold-const.c (revision 216546)
+++ gcc/fold-const.c (working copy)
@@ -10596,8 +10596,9 @@ fold_binary_loc (location_t loc,
TREE_OPERAND (arg1, 0));
tree arg11 = fold_convert_loc (loc, type,
TREE_OPERAND (arg1, 1));
- tree tmp = fold_binary_loc (loc, MINUS_EXPR, type, arg0,
- fold_convert_loc (loc, type, arg10));
+ tree tmp = fold_binary_loc (loc, MINUS_EXPR, type,
+ fold_convert_loc (loc, type, arg0),
+ arg10);
if (tmp)
return fold_build2_loc (loc, MINUS_EXPR, type, tmp, arg11);
}