https://gcc.gnu.org/g:fa6a71aac7eee3ad1597759724992ee1f65ee87f
commit r16-1449-gfa6a71aac7eee3ad1597759724992ee1f65ee87f Author: Eric Botcazou <ebotca...@adacore.com> Date: Wed Apr 2 13:13:33 2025 +0200 ada: Fix rounding test with odd bases The test as currently written is incorrect for odd bases. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Round_Extra): Use multiplicative test. Diff: --- gcc/ada/libgnat/s-valuer.adb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb index 6f557e932079..93e292cc34f4 100644 --- a/gcc/ada/libgnat/s-valuer.adb +++ b/gcc/ada/libgnat/s-valuer.adb @@ -135,7 +135,9 @@ package body System.Value_R is B : constant Uns := Uns (Base); begin - if Digit >= Base / 2 then + -- Beware that Base may be odd + + if 2 * Unsigned (Digit) >= Base then -- If Extra is maximum, round Value