This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix copy&paste error in fold

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


2014-10-23  Richard Biener  <>

	* 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);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]