From: Steve Baird Date: Thu, 14 Apr 2022 20:24:15 +0000 (-0700) Subject: [Ada] Avoid internal compiler error for illegal Predicate_Failure aspect spec X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=382a00418d7214fe678bf99e09f966467fe22a72;p=platform%2Fupstream%2Fgcc.git [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). --- 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));