From: Eric Botcazou Date: Mon, 7 Dec 2020 21:04:43 +0000 (+0100) Subject: [Ada] Couple of adjustments for the sake of static analyzers X-Git-Tag: basepoints/gcc-13~8124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=75716ebc25bfb4a647b05d0b2443b5495dab425e;p=thirdparty%2Fgcc.git [Ada] Couple of adjustments for the sake of static analyzers gcc/ada/ * libgnat/s-valrea.adb (Integer_to_Real): Use a subtype of Num for the component type of the table of powers of ten. * libgnat/s-valuer.adb (Round_Extra): Add assertion on Base. --- diff --git a/gcc/ada/libgnat/s-valrea.adb b/gcc/ada/libgnat/s-valrea.adb index 0ac3846542b7..582b96624862 100644 --- a/gcc/ada/libgnat/s-valrea.adb +++ b/gcc/ada/libgnat/s-valrea.adb @@ -173,7 +173,9 @@ package body System.Val_Real is when 10 => declare - Powten : constant array (0 .. Maxpow) of Num; + subtype Pow_Num is Num range 1.0 .. Num'Last; + + Powten : constant array (0 .. Maxpow) of Pow_Num; pragma Import (Ada, Powten); for Powten'Address use Powten_Address; diff --git a/gcc/ada/libgnat/s-valuer.adb b/gcc/ada/libgnat/s-valuer.adb index 9e4de3e299e0..bd57bfbd88c1 100644 --- a/gcc/ada/libgnat/s-valuer.adb +++ b/gcc/ada/libgnat/s-valuer.adb @@ -128,6 +128,8 @@ package body System.Value_R is Extra : in out Char_As_Digit; Base : Unsigned) is + pragma Assert (Base in 2 .. 16); + B : constant Uns := Uns (Base); begin