From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id 5F6B33858424; Mon, 6 May 2024 09:17:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F6B33858424 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714987028; bh=DD9CeEAHzv00U3Sq34mFVYkGKs/r4BUN/N1ytBwgWZg=; h=From:To:Subject:Date:From; b=hKA/HcWkNE6fteu4ALLONas3n9yDwPUJf30C+HF5ezP8sEYz8ZFL0bl9CWPMzJY1A W7RHJSDfvfV7CwLLexXJlhQXjAkbG5potP750hx+Ef/B9DbbntDHXa9y4XbUyHn8xQ fPYFEIAKQwUuXEXIk7rlVyBnaOitKzRzGlhpUKnY= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Marc Poulhi?s To: gcc-cvs@gcc.gnu.org Subject: [gcc r15-190] ada: Spurious reference warning on qualified expression X-Act-Checkin: gcc X-Git-Author: Justin Squirek X-Git-Refname: refs/heads/master X-Git-Oldrev: 625d5f98d74863ca580008f3566768f46da2c109 X-Git-Newrev: 0b7c0811ced8c98b4bebd1bc89f2272216000900 Message-Id: <20240506091708.5F6B33858424@sourceware.org> Date: Mon, 6 May 2024 09:17:08 +0000 (GMT) List-Id: https://gcc.gnu.org/g:0b7c0811ced8c98b4bebd1bc89f2272216000900 commit r15-190-g0b7c0811ced8c98b4bebd1bc89f2272216000900 Author: Justin Squirek Date: Thu Dec 21 18:31:27 2023 +0000 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. Diff: --- gcc/ada/sem_warn.adb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index eaf9a257ba0..0a54b3eda50 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);