public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-398] [Ada] Facilitate proof of Overwrite in bounded strings library
@ 2022-05-13  8:08 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-13  8:08 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3fe35ab093de715e88fc837155954bbe74b326f3

commit r13-398-g3fe35ab093de715e88fc837155954bbe74b326f3
Author: Yannick Moy <moy@adacore.com>
Date:   Wed Feb 23 12:58:42 2022 +0100

    [Ada] Facilitate proof of Overwrite in bounded strings library
    
    Consistently use >= operator in both the code and contracts of
    function/procedure Overwrite, to facilitate proof, instead of the strict
    inequality > sometimes, as only New_Item remains in the result in the
    case of equal size too.
    
    gcc/ada/
    
            * libgnat/a-strbou.ads (Overwrite): Switch to >= operator in
            contracts.
            * libgnat/a-strsup.adb (Super_Overwrite): Switch to >= operator
            in code of procedure (function already uses it).
            * libgnat/a-strsup.ads (Super_Overwrite): Switch to >= operator
            in contracts.

Diff:
---
 gcc/ada/libgnat/a-strbou.ads | 4 ++--
 gcc/ada/libgnat/a-strsup.adb | 2 +-
 gcc/ada/libgnat/a-strsup.ads | 4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/gcc/ada/libgnat/a-strbou.ads b/gcc/ada/libgnat/a-strbou.ads
index a9ee3b2af1d..839760ac26a 100644
--- a/gcc/ada/libgnat/a-strbou.ads
+++ b/gcc/ada/libgnat/a-strbou.ads
@@ -1898,7 +1898,7 @@ package Ada.Strings.Bounded with SPARK_Mode is
                --  some characters of Source are remaining at the left.
 
                and then
-                 (if New_Item'Length > Max_Length then
+                 (if New_Item'Length >= Max_Length then
 
                     --  New_Item covers all Max_Length characters
 
@@ -1984,7 +1984,7 @@ package Ada.Strings.Bounded with SPARK_Mode is
                --  some characters of Source are remaining at the left.
 
                and then
-                 (if New_Item'Length > Max_Length then
+                 (if New_Item'Length >= Max_Length then
 
                     --  New_Item covers all Max_Length characters
 
diff --git a/gcc/ada/libgnat/a-strsup.adb b/gcc/ada/libgnat/a-strsup.adb
index 2c1b459404b..f1a40a2cd6b 100644
--- a/gcc/ada/libgnat/a-strsup.adb
+++ b/gcc/ada/libgnat/a-strsup.adb
@@ -1226,7 +1226,7 @@ package body Ada.Strings.Superbounded with SPARK_Mode is
                  (New_Item (New_Item'First .. New_Item'Last - Droplen));
 
             when Strings.Left =>
-               if New_Item'Length > Max_Length then
+               if New_Item'Length >= Max_Length then
                   Source.Data (1 .. Max_Length) := Super_String_Data
                     (New_Item
                       (New_Item'Last - Max_Length + 1 .. New_Item'Last));
diff --git a/gcc/ada/libgnat/a-strsup.ads b/gcc/ada/libgnat/a-strsup.ads
index 19e333c2dc2..416fa7bb06a 100644
--- a/gcc/ada/libgnat/a-strsup.ads
+++ b/gcc/ada/libgnat/a-strsup.ads
@@ -2000,7 +2000,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is
             --  Source are remaining at the left.
 
             and then
-              (if New_Item'Length > Source.Max_Length then
+              (if New_Item'Length >= Source.Max_Length then
 
                  --  New_Item covers all Max_Length characters
 
@@ -2089,7 +2089,7 @@ package Ada.Strings.Superbounded with SPARK_Mode is
             --  Source are remaining at the left.
 
             and then
-              (if New_Item'Length > Source.Max_Length then
+              (if New_Item'Length >= Source.Max_Length then
 
                  --  New_Item covers all Max_Length characters


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-13  8:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13  8:08 [gcc r13-398] [Ada] Facilitate proof of Overwrite in bounded strings library Pierre-Marie de Rodat

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