From: Tonu Naks Date: Thu, 22 May 2025 13:07:08 +0000 (+0000) Subject: ada: Disallow underscore before exponent X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9ba0f18bded853cc6504b0843fe05c99c2f03fc;p=thirdparty%2Fgcc.git ada: Disallow underscore before exponent Underscore is allowed only between digits. The current implementattion was considering 'E' as a digit even if it was not in the range of Base and could denote exponent only. gcc/ada/ChangeLog: * libgnat/s-valuer.adb (Scan_Decimal_Digits, Scan_Integral_Digits): fix condition for rejecting underscore. --- diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb index b8073c060b4..961dda47d77 100644 --- a/gcc/ada/libgnat/s-valuer.adb +++ b/gcc/ada/libgnat/s-valuer.adb @@ -287,7 +287,9 @@ package body System.Value_R is if Digit = Underscore and then Index + 1 <= Max then Digit := As_Digit (Str (Index + 1)); - if Digit in Valid_Digit then + if Digit in Valid_Digit and then + (Digit /= E_Digit or else Base > E_Digit) + then Index := Index + 1; else return; @@ -437,7 +439,9 @@ package body System.Value_R is if Digit = Underscore and then Index + 1 <= Max then Digit := As_Digit (Str (Index + 1)); - if Digit in Valid_Digit then + if Digit in Valid_Digit and then + (Digit /= E_Digit or else Base > E_Digit) + then Index := Index + 1; else return;