public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-6452] [Ada] Adapt ghost code to maintain proof
@ 2022-01-11 13:27 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-01-11 13:27 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:371b4ad7c423891d13f9b855f5fdd469a82f7160

commit r12-6452-g371b4ad7c423891d13f9b855f5fdd469a82f7160
Author: Yannick Moy <moy@adacore.com>
Date:   Tue Jan 4 10:37:53 2022 +0100

    [Ada] Adapt ghost code to maintain proof
    
    gcc/ada/
    
            * libgnat/s-expmod.adb (Exp_Modular): Add assertions.

Diff:
---
 gcc/ada/libgnat/s-expmod.adb | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gcc/ada/libgnat/s-expmod.adb b/gcc/ada/libgnat/s-expmod.adb
index 61faed16b25..60d86e505b8 100644
--- a/gcc/ada/libgnat/s-expmod.adb
+++ b/gcc/ada/libgnat/s-expmod.adb
@@ -278,6 +278,7 @@ is
                  (Big (Result) * Big (Factor) ** (Exp - 1),
                   Big (Left) ** Right));
                Lemma_Exp_Expand (Big (Factor), Exp - 1);
+               pragma Assert (Exp / 2 = (Exp - 1) / 2);
             end if;
 
             Lemma_Exp_Expand (Big (Factor), Exp);
@@ -286,6 +287,8 @@ is
             exit when Exp = 0;
 
             Rest := Big (Factor) ** Exp;
+            pragma Assert (Equal_Modulo
+              (Big (Result) * (Rest * Rest), Big (Left) ** Right));
             Lemma_Exp_Mod (Big (Factor) * Big (Factor), Exp, Big (Modulus));
             pragma Assert
               ((Big (Factor) * Big (Factor)) ** Exp = Rest * Rest);


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

only message in thread, other threads:[~2022-01-11 13:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-11 13:27 [gcc r12-6452] [Ada] Adapt ghost code to maintain proof 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).