[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 17:19:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82274
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Author: jakub
Date: Fri Oct 13 17:19:12 2017
New Revision: 253734
URL: https://gcc.gnu.org/viewcvs?rev=253734&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:
trunk/gcc/testsuite/gcc.dg/pr82274-1.c
trunk/gcc/testsuite/gcc.dg/pr82274-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/internal-fn.c
trunk/gcc/testsuite/ChangeLog
trunk/libgcc/ChangeLog
trunk/libgcc/libgcc2.c
More information about the Gcc-bugs
mailing list