public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-609] [Ada] Fix proof of runtime unit s-valeu
Date: Wed, 18 May 2022 08:44:59 +0000 (GMT)	[thread overview]
Message-ID: <20220518084459.53CC33858C52@sourceware.org> (raw)

https://gcc.gnu.org/g:6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440

commit r13-609-g6f8f9d1bcf55187cb81ef7b0ef1e23db1bc0d440
Author: Claire Dross <dross@adacore.com>
Date:   Fri Apr 8 16:38:47 2022 +0200

    [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.

Diff:
---
 gcc/ada/libgnat/s-valueu.adb | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/gcc/ada/libgnat/s-valueu.adb b/gcc/ada/libgnat/s-valueu.adb
index b8bfd447237..f5a6881dbc5 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


                 reply	other threads:[~2022-05-18  8:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518084459.53CC33858C52@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).