[Bug tree-optimization/124988] wrong code with __builtin_mul_overflow() and shift of _BitInt() on riscv
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Apr 30 11:09:54 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124988
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-16 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:
https://gcc.gnu.org/g:e33201aa19c9e418e22c9b160c5f34755a8141d8
commit r16-8828-ge33201aa19c9e418e22c9b160c5f34755a8141d8
Author: Jakub Jelinek <jakub@redhat.com>
Date: Fri Apr 24 14:36:29 2026 +0200
bitintlower: Padding bit fixes, part 5 [PR123635]
The following patch is hopefully the last missing part of the _BitInt
bitint_extended padding bit fixes, this time for
__builtin_{add,sub,mul}_overflow. For __builtin_{add,sub}_overflow,
the extension in the padding bits of a partial limb (if any) is already
done in some cases during the handling of the limbs (and the last
hunk in gimple-lower-bitint.cc just adds it to one spot where it was
missing). The extension in the padding bits of a full limb of padding
bits (if any) and for __builtin_mul_overflow partial limb too is done
in finish_arith_overflow. If both var and obj are NULL, it is
__builtin_*_overflow_p or __builtin_*_overflow that ignores the result
of the operation and only cares about whether it overflowed or not; in
that case there is nothing to extend.
2026-04-24 Jakub Jelinek <jakub@redhat.com>
PR middle-end/123635
PR tree-optimization/124988
* gimple-lower-bitint.cc
(bitint_large_huge::finish_arith_overflow):
Handle bitint_extend.
(bitint_large_huge::lower_addsub_overflow): Fix up comment
spelling.
For bitint_extended extend the partial limb if any.
* gcc.dg/torture/bitint-91.c: New test.
* gcc.dg/torture/bitint-92.c: New test.
* gcc.dg/torture/bitint-93.c: New test.
* gcc.dg/torture/bitint-94.c: New test.
* gcc.dg/torture/bitint-95.c: New test.
Reviewed-by: Richard Biener <rguenth@suse.de>
(cherry picked from commit dcaa624319dc58ed8b1f51f6e0718cba94d7a3b9)
More information about the Gcc-bugs
mailing list