aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2023-12-21 18:31:27 +0000
committerMarc Poulhiès <poulhies@adacore.com>2024-05-06 11:11:29 +0200
commit0b7c0811ced8c98b4bebd1bc89f2272216000900 (patch)
tree969481f5c0fda9563b3077eb03c63bfc15fad09d /gcc/ada
parent625d5f98d74863ca580008f3566768f46da2c109 (diff)
downloadgcc-0b7c0811ced8c98b4bebd1bc89f2272216000900.zip
gcc-0b7c0811ced8c98b4bebd1bc89f2272216000900.tar.gz
gcc-0b7c0811ced8c98b4bebd1bc89f2272216000900.tar.bz2
ada: Spurious reference warning on qualified expression
This patch fixes an error in the compiler whereby an assignment to an out formal (whose type requires a predicate check) can lead to spurious "value may be referenced before it has a value" warnings when the RHS is a qualified expression. gcc/ada/ * sem_warn.adb (Within_Postcondition): Add case to ignore references within generated predicate function calls.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/sem_warn.adb10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index eaf9a25..0a54b3e 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -1982,6 +1982,16 @@ package body Sem_Warn is
then
return True;
+ -- Verify we are not within a generated predicate
+ -- function call.
+
+ elsif Nkind (Nod) = N_Function_Call
+ and then Is_Entity_Name (Name (Nod))
+ and then Is_Predicate_Function
+ (Entity (Name (Nod)))
+ then
+ return True;
+
elsif Present (Parent (Nod)) then
P := Parent (Nod);