This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/82274] __builtin_mul_overflow fails to detect overflow for int64_t when compiled with -m32
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 13 Oct 2017 20:15:16 +0000
- Subject: [Bug target/82274] __builtin_mul_overflow fails to detect overflow for int64_t when compiled with -m32
- Auto-submitted: auto-generated
- References: <bug-82274-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82274
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Oct 13 20:14:34 2017
New Revision: 253743
URL: https://gcc.gnu.org/viewcvs?rev=253743&root=gcc&view=rev
Log:
PR target/82274
* internal-fn.c (expand_mul_overflow): If both operands have
the same highpart of -1 or 0 and the topmost bit of lowpart
is different, overflow is if res <= 0 rather than res < 0.
* libgcc2.c (__mulvDI3): If both operands have
the same highpart of -1 and the topmost bit of lowpart is 0,
multiplication overflows even if both lowparts are 0.
* gcc.dg/pr82274-1.c: New test.
* gcc.dg/pr82274-2.c: New test.
Added:
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr82274-1.c
branches/gcc-6-branch/gcc/testsuite/gcc.dg/pr82274-2.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/internal-fn.c
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/libgcc/ChangeLog
branches/gcc-6-branch/libgcc/libgcc2.c