From 382a00418d7214fe678bf99e09f966467fe22a72 Mon Sep 17 00:00:00 2001 From: Steve Baird Date: Thu, 14 Apr 2022 13:24:15 -0700 Subject: [PATCH] [Ada] Avoid internal compiler error for illegal Predicate_Failure aspect spec gcc/ada/ * sem_ch13.adb (Build_Predicate_Functions): If a semantic error has been detected then ignore Predicate_Failure aspect specifications in the same way as is done for CodePeer and SPARK. This avoids an internal compiler error if Ancestor_Predicate_Function_Called is True but Result_Expr is not an N_And_Then node (and is therefore unsuitable as an argument in a call to Left_Opnd). --- gcc/ada/sem_ch13.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index c405d15..11abdd8 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10489,11 +10489,14 @@ package body Sem_Ch13 is begin -- 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. + -- comes from the Predicate_Failure. Ditto for CodePeer. + -- And an illegal Predicate_Failure aspect can lead to cases + -- we want to avoid. if Present (PF_Expr) and then not GNATprove_Mode and then not CodePeer_Mode + and then Serious_Errors_Detected = 0 then pragma Assert (Present (Second_Formal)); -- 2.7.4