From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id E99B53858C50; Mon, 16 May 2022 08:44:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E99B53858C50 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-498] [Ada] Freeze target type on qualified expression expansion X-Act-Checkin: gcc X-Git-Author: Etienne Servais X-Git-Refname: refs/heads/master X-Git-Oldrev: c1e007985fef1389ba09f5b558aa4e7b9f03783f X-Git-Newrev: 26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2 Message-Id: <20220516084453.E99B53858C50@sourceware.org> Date: Mon, 16 May 2022 08:44:53 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2022 08:44:54 -0000 https://gcc.gnu.org/g:26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2 commit r13-498-g26bbf0e5da9af096eeddc2a79e1e0da9673b6bd2 Author: Etienne Servais Date: Mon Mar 14 14:35:43 2022 +0100 [Ada] Freeze target type on qualified expression expansion An object declaration (other than a deferred constant declaration) causes freezing where it occurs (13.14(6)), which means every name occurring within it causes freezing (13.14(4/1)), and when the name in a subtype_mark causes freezing, the denoted subtype is frozen (13.14(11)). Hence, one needs to freeze the target type when expanding a qualified expression. gcc/ada/ * exp_ch4.adb (Expand_N_Qualified_Expression): Freeze Target_Type. Diff: --- gcc/ada/exp_ch4.adb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 99fac5f8b6b..74d40e5affd 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -10776,6 +10776,8 @@ package body Exp_Ch4 is Ensure_Valid (Operand); end if; + Freeze_Before (Operand, Target_Type); + -- Apply possible constraint check Apply_Constraint_Check (Operand, Target_Type, No_Sliding => True);