fold-const.c (fold_binary_loc): Don't fold if the result is undefined.
authorMarek Polacek <polacek@redhat.com>
Wed, 12 Nov 2014 14:36:41 +0000 (14:36 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 12 Nov 2014 14:36:41 +0000 (14:36 +0000)
commit2f68e8bcc034e43b736b5d6789192f53fec88481
tree360555bbd6800c3e583ecae19b0e459896958de5
parentb8c03a9b391b02a6ace91b216e50926b49dbaae0
fold-const.c (fold_binary_loc): Don't fold if the result is undefined.

* fold-const.c (fold_binary_loc): Don't fold if the result
is undefined.
* match.pd (A + (-B) -> A - B, A - (-B) -> A + B,
-(-A) -> A): Likewise.

* c-c++-common/ubsan/overflow-sub-4.c: New test.
* c-c++-common/ubsan/overflow-sub-2.c: Adjust dg-output.
* c-c++-common/ubsan/overflow-int128.c: Likewise.

From-SVN: r217427
gcc/ChangeLog
gcc/fold-const.c
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/ubsan/overflow-int128.c
gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c
gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c [new file with mode: 0644]