re PR middle-end/56917 (-ftrapv detects a overflow wrongly.)
authorMarek Polacek <polacek@redhat.com>
Thu, 4 Dec 2014 19:20:12 +0000 (19:20 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 4 Dec 2014 19:20:12 +0000 (19:20 +0000)
commit3119ac2925882e0e7b30984d71093eef349cabcc
tree57ddb125dd815eba52b7c03670badf6f9e880a46
parentd348be26b9d5c668e37459f65ab88ece7d2db2d6
re PR middle-end/56917 (-ftrapv detects a overflow wrongly.)

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.

* c-c++-common/ubsan/pr56917.c: New test.

From-SVN: r218395
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/pr56917.c [new file with mode: 0644]