[Bug libgcc/113604] runtime SIGFPE with _BitInt() division
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 25 23:03:05 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113604
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
longlong.h documents that
HIGH_NUMERATOR must be less
than DENOMINATOR for correct operation. If, in addition, the most
significant bit of DENOMINATOR must be 1, then the pre-processor symbol
UDIV_NEEDS_NORMALIZATION is defined to 1.
While UDIV_NEEDS_NORMALIZATION is 1 only on sh32 and arches which don't define
their udiv_qrnnd and fallback to C, the first requirement is there for all
arches.
0xffffffff'ffffffff'ffff8000'03e00001uwb / 0xffffffff'ffffffffuwb
is 0x1'00000000'00000000uwb and
0xffffffff'ffffffff'ffff8000'03e00001uwb % 0xffffffff'ffffffffuwb
is 0xffff8000'03e00001uwb, so the quotient isn't representable in 64-bit
number, which is why SIGFPE is triggered.
More information about the Gcc-bugs
mailing list