]> git.ipfire.org Git - thirdparty/gcc.git/commit
middle-end/108995 - avoid folding when sanitizing overflow
authorRichard Biener <rguenther@suse.de>
Wed, 8 Mar 2023 08:06:44 +0000 (09:06 +0100)
committerRichard Biener <rguenther@suse.de>
Thu, 9 Mar 2023 13:28:12 +0000 (14:28 +0100)
commitace65db9215882b95e2ead1bb0dc8c54c2ea69be
tree9418917716b26f7435a3e3af6974369308de599c
parentbad177e848787258070415dbe002b2c6fba1c511
middle-end/108995 - avoid folding when sanitizing overflow

The following plugs one place in extract_muldiv where it should avoid
folding when sanitizing overflow.

PR middle-end/108995
* fold-const.cc (extract_muldiv_1): Avoid folding
(CST * b) / CST2 when sanitizing overflow and we rely on
overflow being undefined.

* gcc.dg/ubsan/pr108995.c: New testcase.
gcc/fold-const.cc
gcc/testsuite/gcc.dg/ubsan/pr108995.c [new file with mode: 0644]