From b872d3fe67b54fef84ccafc7d39f1017a68332c2 Mon Sep 17 00:00:00 2001
From: Yannick Moy <moy@adacore.com>
Date: Mon, 4 Jul 2022 10:49:02 +0000
Subject: [PATCH] [Ada] Fix automatic proof on System.Arith_32

gcc/ada/

	* libgnat/s-arit32.adb (Scaled_Divide32): Add an assertion, move
	the call of Prove_Sign_R around.
---
 gcc/ada/libgnat/s-arit32.adb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/libgnat/s-arit32.adb b/gcc/ada/libgnat/s-arit32.adb
index 6dac5725a59e..c3d9f6a50bc3 100644
--- a/gcc/ada/libgnat/s-arit32.adb
+++ b/gcc/ada/libgnat/s-arit32.adb
@@ -541,8 +541,10 @@ is
          end if;
       end if;
 
+      pragma Assert (In_Int32_Range (Big_Q));
       pragma Assert (Big (Qu) = abs Big_Q);
       pragma Assert (Big (Ru) = abs Big_R);
+      Prove_Sign_R;
 
       --  Set final signs (RM 4.5.5(27-30))
 
@@ -563,7 +565,6 @@ is
          Q := (if Z > 0 then To_Neg_Int (Qu) else To_Pos_Int (Qu));
       end if;
 
-      Prove_Sign_R;
       Prove_Signs;
    end Scaled_Divide32;
 
-- 
GitLab