[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 Jakub Jelinek changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #9 from Jakub Jelinek --- Fixed for 10+, 9.3+ and 8.4+.
[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 --- Comment #8 from Jakub Jelinek --- Author: jakub Date: Thu Nov 21 17:18:17 2019 New Revision: 278583 URL: https://gcc.gnu.org/viewcvs?rev=278583=gcc=rev Log: Backported from mainline 2019-11-19 Jakub Jelinek 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. Added: branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/execute/pr91450-1.c branches/gcc-8-branch/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c Modified: branches/gcc-8-branch/gcc/ChangeLog branches/gcc-8-branch/gcc/internal-fn.c branches/gcc-8-branch/gcc/testsuite/ChangeLog
[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 --- Comment #7 from Jakub Jelinek --- Author: jakub Date: Tue Nov 19 09:26:23 2019 New Revision: 278438 URL: https://gcc.gnu.org/viewcvs?rev=278438=gcc=rev Log: 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. Added: branches/gcc-9-branch/gcc/testsuite/gcc.c-torture/execute/pr91450-1.c branches/gcc-9-branch/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c Modified: branches/gcc-9-branch/gcc/ChangeLog branches/gcc-9-branch/gcc/internal-fn.c branches/gcc-9-branch/gcc/testsuite/ChangeLog
[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 --- Comment #6 from Jakub Jelinek --- Author: jakub Date: Tue Nov 19 09:15:53 2019 New Revision: 278437 URL: https://gcc.gnu.org/viewcvs?rev=278437=gcc=rev Log: 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. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr91450-1.c trunk/gcc/testsuite/gcc.c-torture/execute/pr91450-2.c Modified: trunk/gcc/ChangeLog trunk/gcc/internal-fn.c trunk/gcc/testsuite/ChangeLog
[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 --- Comment #5 from Jakub Jelinek --- Created attachment 47290 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47290=edit gcc10-pr91450.patch Untested fix.
[Bug middle-end/91450] __builtin_mul_overflow(A,B,R) wrong code if product < 0, *R is unsigned, and !(A)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91450 Jakub Jelinek changed: What|Removed |Added Component|target |middle-end Target Milestone|--- |8.4