public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Ignore Predicate_Failure in GNATprove mode
@ 2022-05-19 14:16 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-05-19 14:16 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

[-- Attachment #1: Type: text/plain, Size: 279 bytes --]

In GNATprove mode we are don't want predicate failure to pollute the
predicate expression extracted from the predicate function.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* sem_ch13.adb (Build_Predicate_Function): Ignore predicate
	failure in GNATprove mode.

[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 778 bytes --]

diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -10487,7 +10487,13 @@ package body Sem_Ch13 is
                Second_Formal : constant Entity_Id :=
                  Next_Entity (Object_Entity);
             begin
-               if Present (PF_Expr) then
+               --  In GNATprove mode we are only interested in the predicate
+               --  expression itself and don't want a raise expression that
+               --  comes from the Predicate_Failure.
+
+               if Present (PF_Expr)
+                 and then not GNATprove_Mode
+               then
                   pragma Assert (Present (Second_Formal));
 
                   --  This is an ugly hack to cope with an ugly situation.



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

only message in thread, other threads:[~2022-05-19 14:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 14:16 [Ada] Ignore Predicate_Failure in GNATprove mode 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).