* fold-const.c (fold_negate_expr): Don't fold INTEGER_CST if
commit1043013c91c08e3d8cd665b3f960f658918d69fe
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 Nov 2014 11:57:05 +0000 (14 11:57 +0000)
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 14 Nov 2014 11:57:05 +0000 (14 11:57 +0000)
treee658bdd67d7d906e29048429d363eaa3f48eaab0
parentf6b540af02190c7c3e07a26eb5864f9a24fe7274
* fold-const.c (fold_negate_expr): Don't fold INTEGER_CST if
that overflows when SANITIZE_SI_OVERFLOW is on.  Guard -(-A)
folding with TYPE_OVERFLOW_SANITIZED.

* c-c++-common/ubsan/overflow-negate-3.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@217556 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c [new file with mode: 0644]