diff options
author | Steve Baird <baird@adacore.com> | 2022-04-14 13:24:15 -0700 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-19 14:05:31 +0000 |
commit | 382a00418d7214fe678bf99e09f966467fe22a72 (patch) | |
tree | 3f6bb937917a2acbede77722ffc69f9eca291e96 | |
parent | bf0b180b42babb61b4e16388b88350d75aad3c27 (diff) | |
download | gcc-382a00418d7214fe678bf99e09f966467fe22a72.zip gcc-382a00418d7214fe678bf99e09f966467fe22a72.tar.gz gcc-382a00418d7214fe678bf99e09f966467fe22a72.tar.bz2 |
[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).
-rw-r--r-- | gcc/ada/sem_ch13.adb | 5 |
1 files changed, 4 insertions, 1 deletions
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)); |