]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/internal-fn.cc
re PR middle-end/91450 (__builtin_mul_overflow(A,B,R) wrong code if product < 0,...
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Nov 2019 09:15:53 +0000 (10:15 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Nov 2019 09:15:53 +0000 (10:15 +0100)
commitbeeac4c2716e5873648c67f71ba810cc02f7f8a8
tree4c2b11543f8cbac0211a4c2e2d84f10948ed68d8
parent655b60f966e83d82c8ae4c50648e1489cf0ce4d2
re PR middle-end/91450 (__builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A&B))

PR middle-end/91450
* internal-fn.c (expand_mul_overflow): For s1 * s2 -> ur, if one
operand is negative and one non-negative, compare the non-negative
one against 0 rather than comparing s1 & s2 against 0.  Otherwise,
don't compare (s1 & s2) == 0, but compare separately both s1 == 0
and s2 == 0, unless one of them is known to be negative.  Remove
tem2 variable, use tem where tem2 has been used before.

* gcc.c-torture/execute/pr91450-1.c: New test.
* gcc.c-torture/execute/pr91450-2.c: New test.

From-SVN: r278437
gcc/ChangeLog
gcc/internal-fn.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr91450-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/execute/pr91450-2.c [new file with mode: 0644]