aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/libgnat
diff options
context:
space:
mode:
authorClaire Dross <dross@adacore.com>2022-04-08 16:38:47 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-18 08:41:08 +0000
commit6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440 (patch)
tree75d9b79de26a1a27e49d3742285dd37d480c14d3 /gcc/ada/libgnat
parentdf4451ca663e251e5524ebedb34bbe0cbfc45e52 (diff)
downloadgcc-6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440.zip
gcc-6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440.tar.gz
gcc-6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440.tar.bz2
[Ada] Fix proof of runtime unit s-valeu
Update to provers caused some proof regressions. Fix the proof by changing ghost code. gcc/ada/ * libgnat/s-valueu.adb (Scan_Raw_Unsigned): Add assertions.
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r--gcc/ada/libgnat/s-valueu.adb12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/ada/libgnat/s-valueu.adb b/gcc/ada/libgnat/s-valueu.adb
index b8bfd44..f5a6881 100644
--- a/gcc/ada/libgnat/s-valueu.adb
+++ b/gcc/ada/libgnat/s-valueu.adb
@@ -522,6 +522,9 @@ package body System.Value_U is
Uval := Base;
Base := 10;
pragma Assert (Ptr.all = Last_Num_Init + 1);
+ pragma Assert
+ (if Starts_As_Based then P = Last_Num_Based + 1);
+ pragma Assert (not Is_Based);
pragma Assert (if not Overflow then Uval = Init_Val.Value);
exit;
end if;
@@ -569,10 +572,6 @@ package body System.Value_U is
end if;
end if;
- Lemma_Scan_Digit
- (Str, P, Last_Num_Based, Digit, Base, Old_Uval, Uval,
- Based_Val, Old_Overflow, Overflow);
-
-- If at end of string with no base char, not a based number
-- but we signal Constraint_Error and set the pointer past
-- the end of the field, since this is what the ACVC tests
@@ -580,6 +579,10 @@ package body System.Value_U is
P := P + 1;
+ Lemma_Scan_Digit
+ (Str, P - 1, Last_Num_Based, Digit, Base, Old_Uval, Uval,
+ Based_Val, Old_Overflow, Overflow);
+
if P > Max then
Ptr.all := P;
Bad_Value (Str);
@@ -590,6 +593,7 @@ package body System.Value_U is
if Str (P) = Base_Char then
Ptr.all := P + 1;
pragma Assert (Ptr.all = Last_Num_Based + 2);
+ pragma Assert (Is_Based);
pragma Assert
(if not Overflow then
Based_Val = Scan_Based_Number_Ghost