From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7871) id F300D388266E; Fri, 26 May 2023 07:37:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F300D388266E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685086629; bh=lvHukCtizV2RljkRCmEBWJMHM1RoqmcXH70Ywtdv6/A=; h=From:To:Subject:Date:From; b=LRwfp9RzJ7+hLS3Mhx9/j6UPe43DUr0/YSr+oOFc1TbnvEj2x05KxSioFzGqH8hiO hbqGuBP8NXOuWr+tLbmdBL3nqSs7jHEf29P15XSVrMRHojayZYz6oIrF2KMAG0YUXZ DtN3h2xolHC15RB3hPWbeO46fvRFvpNyX47HokqY= 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 r14-1279] ada: Fix detection of non-static expressions in records with pragmas X-Act-Checkin: gcc X-Git-Author: Piotr Trojanek X-Git-Refname: refs/heads/master X-Git-Oldrev: 2688795b716b1ec75826e150c2d1dd04c88f3ad6 X-Git-Newrev: 70f609b01fde630141e683f9563545b8dff87ad6 Message-Id: <20230526073709.F300D388266E@sourceware.org> Date: Fri, 26 May 2023 07:37:09 +0000 (GMT) List-Id: https://gcc.gnu.org/g:70f609b01fde630141e683f9563545b8dff87ad6 commit r14-1279-g70f609b01fde630141e683f9563545b8dff87ad6 Author: Piotr Trojanek Date: Thu Mar 23 18:46:08 2023 +0100 ada: Fix detection of non-static expressions in records with pragmas When iterating over record components we must ignore pragmas. Minor bug, as pragmas within record components do not appear often. gcc/ada/ * sem_cat.adb (Check_Non_Static_Default_Expr): Detect components inside loop, not in the loop condition itself. Diff: --- gcc/ada/sem_cat.adb | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/gcc/ada/sem_cat.adb b/gcc/ada/sem_cat.adb index 09560e6179a..13dff3dbdd9 100644 --- a/gcc/ada/sem_cat.adb +++ b/gcc/ada/sem_cat.adb @@ -346,14 +346,13 @@ package body Sem_Cat is if Null_Present (Recdef) then return; - else - Component_Decl := First (Component_Items (Component_List (Recdef))); end if; - while Present (Component_Decl) - and then Nkind (Component_Decl) = N_Component_Declaration - loop - if Present (Expression (Component_Decl)) + Component_Decl := First (Component_Items (Component_List (Recdef))); + + while Present (Component_Decl) loop + if Nkind (Component_Decl) = N_Component_Declaration + and then Present (Expression (Component_Decl)) and then Nkind (Expression (Component_Decl)) /= N_Null and then not Is_OK_Static_Expression (Expression (Component_Decl))