https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56917
--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> --- Author: rguenth Date: Thu Jun 18 14:47:18 2015 New Revision: 224617 URL: https://gcc.gnu.org/viewcvs?rev=224617&root=gcc&view=rev Log: 2015-06-18 Richard Biener <rguent...@suse.de> Backport from mainline 2014-12-04 Marek Polacek <pola...@redhat.com> PR middle-end/56917 * fold-const.c (fold_unary_loc): Perform the negation in A's type when transforming ~ (A - 1) or ~ (A + -1) to -A. * g++.dg/other/const4.C: New testcase. Added: branches/gcc-4_8-branch/gcc/testsuite/g++.dg/other/const4.C Modified: branches/gcc-4_8-branch/gcc/ChangeLog branches/gcc-4_8-branch/gcc/fold-const.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog