[Bug ada/122063] unexpected overflow check before fixed-point multiplication
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 28 10:27:31 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122063
--- Comment #2 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marc Poulhies <dkm@gcc.gnu.org>:
https://gcc.gnu.org/g:f714e1baf8804dfcff5bf9f23cd548c2c2e32a40
commit r16-4687-gf714e1baf8804dfcff5bf9f23cd548c2c2e32a40
Author: Eric Botcazou <ebotcazou@adacore.com>
Date: Fri Sep 26 19:45:10 2025 +0200
ada: Fix unexpected overflow check before fixed-point multiplication
The problem is that the code generating the fixed-point multiply uses the
subtypes of the operands to size the operation, while operations are to be
performed in base types, which are signed per the RM 3.5.9(12) subclause.
As a consequence, when the subtypes are fully asymmetric unsigned, the size
is too small and an incorrect overflow check is generated.
The code generating the divide was fixed a long time ago, this aligns the
code generating the multiply and the code generating the remainder, which
in turn requires a couple of adjustments to related routines.
gcc/ada/ChangeLog:
PR ada/122063
* exp_fixd.adb (Build_Double_Divide_Code): Convert the result of
the
multiply.
(Build_Multiply): Use base types of operands to size the operation.
(Build_Rem): Likewise.
(Build_Scaled_Divide_Code): Convert the result of the multiply.
More information about the Gcc-bugs
mailing list