[Bug target/82274] __builtin_mul_overflow fails to detect overflow for int64_t when compiled with -m32
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 13 20:15:00 GMT 2017
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
More information about the Gcc-bugs
mailing list