From patchwork Tue Jan 9 13:15:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 186369 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp99829dyi; Tue, 9 Jan 2024 05:18:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IH+FZfp2e2bRl1a7muWoWECOF/ku43CWz0Wg1nsRxZRYVPUF1dOYkP4Gc72H1VQo1X4KS3b X-Received: by 2002:ac8:5990:0:b0:429:87bb:c010 with SMTP id e16-20020ac85990000000b0042987bbc010mr6819670qte.51.1704806337523; Tue, 09 Jan 2024 05:18:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704806337; cv=pass; d=google.com; s=arc-20160816; b=iJojOrgkcI1P4zvrS60zSLlj9Rvp8u5umc63IrcrmcicF/pVpKsJktcEE4p3Y0sUuz bA8e9+qn89Y/A24FeNpkrp33I+oPm/zFmZjwmSzCbciQc+pSVhv3dvWAT4AH4ze1Sned XCKgU5YHYG1iXn/fPAgEZZNY86RY48Qo/A/+CGYDZI/oetQ+hIfUHSfnTZ2fvUz0wZ4R Ws/rvzvTWkv9VDtxVmgwTZjPP9dgz+MYwwuYA9nklyNcSiRlVJBS/N1o8iESAkQx2NWR kbD4AkjylH2GWWfM8xBqUnp+a2x0gQYlzSFjbx/aOGYcwqMkeGBlaEIm7M8lJFuS4g8d 5X4g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=+p64FFQ+vJrbIfeFXKBf/N8Xcme7bHjnjwCwJ7T2F+s=; fh=hOhsC1930eHatDPYd2EALQ9Ry/g++vvN4vxlQkRuX+0=; b=0f7U1DGJpcTOwokQCy2B+IDyLL1dLFe3nBrwqKFg0Xto1F7YDf9Fe4nLtXCVUR0mjb hot2DSVRoBBQJEQ+Z/JTQzElcTJcuajYP5lf0x8NGYQTFyLqo8OjatVfO08IpqlNIpdw PVw1atcIbNI801y0kT1P5c4rwqMjBJ4Df1IMlQTUijibmjjNPSj1CRriA22llM4Q1KbD LO1q5VAS0VKZ7pDLuqdZvqCnoTQvlra5JRz7fowAVI/r15H0tpJxQik4XcGThcax6aY9 6dsnG96lEwImx41XfjryiWzXGQqKfPqXCGnOdD742FWdMf3UGISnQCt1RE881jMfzzTI Ib3A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=QK3qJeh1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id g10-20020ac87f4a000000b00429a690da24si1124298qtk.311.2024.01.09.05.18.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:18:57 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=QK3qJeh1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D10F8384F4B8 for ; Tue, 9 Jan 2024 13:18:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [IPv6:2a00:1450:4864:20::32a]) by sourceware.org (Postfix) with ESMTPS id 28595386074C for ; Tue, 9 Jan 2024 13:15:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 28595386074C Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 28595386074C Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806135; cv=none; b=aR+7q1Po+mbtzRxqLFU2gqRMqabqojlG1XdbCqs/yHiLHbn/OFL3moBZVCWX0yXbHjy5GOY8wO9mHYpZcSwJ/XrdZPhHA5/ZL+eXGpg+IBe0JXCoJ9tZ6npHqMS1Di5DXrnxx188N4AZTZDjKqM2bdVZPJbmDdZboVUV07v/h6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806135; c=relaxed/simple; bh=ltqsMOZMgY/nr1hEGbtBzPLO6zgdOCjll3M+aUGWwz0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=UJprvwlDvWkmLW+pgPyIISM8DiNPP21Q2QlYBUIsUqqFY7VNq+F2dGrUD1WULuo9P3iiX85zoTud4Q+SRmJkj6gHXivLJ1ZOMlD8/Rr8jX7bdbKwbDUV7g3ORrrJ4Bo7nm3YMVXkPvgDXc3Txux7Fxi0wMqDLwAcd/NlsXSWIzQ= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40d60c49ee7so33404795e9.0 for ; Tue, 09 Jan 2024 05:15:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704806132; x=1705410932; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+p64FFQ+vJrbIfeFXKBf/N8Xcme7bHjnjwCwJ7T2F+s=; b=QK3qJeh1AAb2Vk937tfc1+zk5tIQbTBqH+9UF6xLTRfxOtcI9S/mxTj40rQ2p6yzzg 8HH/PQ2V9kZdI+aHRGEfHlUHEgeV3HZzKQDGEZ765ukJQxoJ+z/egoTVir7h9qDOUPoM YEbTLaoFPjmAdc3nXUxTjZ51wmmSv9mvKP4NshwpQBzymP0tULRa4mdGHzt7qvQcOXQ8 5oo1NVuH5/Q6PLgUXKbjYMNTEjRc4gb3wb8iwbHC2sN7Y4fnQH70MpRVxRfvQsUH+Eyv tEVLFiQS2FiHMpzILB+BvUA7nwBMKjir1hpXNxOXaQyygiKSoiaEJpml7AflanAU6LoC rADg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806132; x=1705410932; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+p64FFQ+vJrbIfeFXKBf/N8Xcme7bHjnjwCwJ7T2F+s=; b=kE5qP/Qhck8BxY4bksHut90b8XoRn98Wrjwu3fW4q6MSlNymqjO6g0xn1C6POQvd8l jW0Nsg9l+e0zrlAXf6/9VbDEyAdBQafAMb0Xgd+wYZ8p1LzvjZrIGvqws88T4a9EAkuk y5knzDnJv5w7LlX8zrSByJVxMxKPCk9/De/2nVs9IZTpQoXEFFmVHEL76zmut6ilG8UY Kxm8IK2IAo0vWnUKLkLSk753Z/Jzu6MyNGM5nJ3lCGLdbV29QqmtvoosYGovP5EO2Jm0 decfluGmwguryfJwtIDvziD92i1ZtJllsO52DdX8/btwiPnZInkMXLklQsucRpLV8RpW +aJQ== X-Gm-Message-State: AOJu0YyZCj37ptvNd9rjCqexx8sibZSwTbLhZx19M3BXWyuahZlbzLAA szW2gDVKAh8pamw4CwXzhsHbW5Keco5LbtNTTwPMziqXdw== X-Received: by 2002:a7b:c5cd:0:b0:40d:5c7e:6f69 with SMTP id n13-20020a7bc5cd000000b0040d5c7e6f69mr2628582wmk.147.1704806131805; Tue, 09 Jan 2024 05:15:31 -0800 (PST) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id be10-20020a05600c1e8a00b0040e49994116sm5424474wmb.14.2024.01.09.05.15.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:15:31 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Remove unreachable code in Resolve_Extension_Aggregate Date: Tue, 9 Jan 2024 14:15:30 +0100 Message-ID: <20240109131530.743848-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787619009787179415 X-GMAIL-MSGID: 1787619009787179415 From: Eric Botcazou The only functions using the BIP protocol are now those returning a limited type: Is_Build_In_Place_Result_Type => Is_Inherently_Limited_Type. gcc/ada/ * sem_aggr.adb (Resolve_Extension_Aggregate): Remove the unreachable call to Transform_BIP_Assignment as well as the procedure. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_aggr.adb | 39 +-------------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb index 1027acf20b5..f586c18e655 100644 --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -31,7 +31,6 @@ with Einfo.Utils; use Einfo.Utils; with Elists; use Elists; with Errout; use Errout; with Expander; use Expander; -with Exp_Ch6; use Exp_Ch6; with Exp_Tss; use Exp_Tss; with Exp_Util; use Exp_Util; with Freeze; use Freeze; @@ -4232,11 +4231,6 @@ package body Sem_Aggr is -- Verify that the type of the ancestor part is a non-private ancestor -- of the expected type, which must be a type extension. - procedure Transform_BIP_Assignment (Typ : Entity_Id); - -- For an extension aggregate whose ancestor part is a build-in-place - -- call returning a nonlimited type, this is used to transform the - -- assignment to the ancestor part to use a temp. - ---------------------------- -- Valid_Limited_Ancestor -- ---------------------------- @@ -4328,26 +4322,6 @@ package body Sem_Aggr is return False; end Valid_Ancestor_Type; - ------------------------------ - -- Transform_BIP_Assignment -- - ------------------------------ - - procedure Transform_BIP_Assignment (Typ : Entity_Id) is - Loc : constant Source_Ptr := Sloc (N); - Def_Id : constant Entity_Id := Make_Temporary (Loc, 'Y', A); - Obj_Decl : constant Node_Id := - Make_Object_Declaration (Loc, - Defining_Identifier => Def_Id, - Constant_Present => True, - Object_Definition => New_Occurrence_Of (Typ, Loc), - Expression => A, - Has_Init_Expression => True); - begin - Set_Etype (Def_Id, Typ); - Set_Ancestor_Part (N, New_Occurrence_Of (Def_Id, Loc)); - Insert_Action (N, Obj_Decl); - end Transform_BIP_Assignment; - -- Start of processing for Resolve_Extension_Aggregate begin @@ -4521,19 +4495,8 @@ package body Sem_Aggr is -- an AdaCore query to the ARG after this test was added. Error_Msg_N ("ancestor part must be statically tagged", A); - else - -- We are using the build-in-place protocol, but we can't build - -- in place, because we need to call the function before - -- allocating the aggregate. Could do better for null - -- extensions, and maybe for nondiscriminated types. - -- This is wrong for limited, but those were wrong already. - - if not Is_Inherently_Limited_Type (A_Type) - and then Is_Build_In_Place_Function_Call (A) - then - Transform_BIP_Assignment (A_Type); - end if; + else Resolve_Record_Aggregate (N, Typ); end if; end if;