https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67662
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- Author: rguenth Date: Wed Sep 23 14:09:48 2015 New Revision: 228051 URL: https://gcc.gnu.org/viewcvs?rev=228051&root=gcc&view=rev Log: 2015-09-23 Richard Biener <rguent...@suse.de> PR middle-end/67662 * fold-const.c (fold_binary_loc): Do not reassociate two vars with undefined overflow unless they will cancel out. * gcc.dg/ubsan/pr67662.c: New testcase. Added: trunk/gcc/testsuite/gcc.dg/ubsan/pr67662.c Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog