https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68252
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Status|UNCONFIRMED |NEW Last reconfirmed| |2015-11-09 Version|unknown |5.2.1 Ever confirmed|0 |1 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Looks like a bogus folding to me (CST << B * CST -> CST' << B). return -3 << a; from .original and int foo (int a) { return (1 << a) * -3; } On trunk: /* Fold (a * (1 << b)) into (a << b) */ (simplify (mult:c @0 (convert? (lshift integer_onep@1 @2))) (if (! FLOAT_TYPE_P (type) && tree_nop_conversion_p (type, TREE_TYPE (@1))) (lshift @0 @2))) on the branch this is still in fold-const.c. Note that I think this undefinedness doesn't buy us anything and that we should just make sure to not emit bogus ubsan errors or warnings.