From patchwork Wed May 18 08:43:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 54125 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id DFA89385781D for ; Wed, 18 May 2022 08:46:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFA89385781D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652863605; bh=ntMo5FVDezApoURh+aQ+wp1CPY0N6wA+UxIxsmlw8qQ=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=FMKE2H7bO97H8jluUQSvJeS7X+03Ir7ZrIVVKkcyYAWYOVUMH0n+rco1hGsMsCEdr 4Uqn/V9FuflYGX3YeszL/jH6xCLawv/2IaTdpxWIR9mpLGTJbEuR6+pqYzoH9msd03 4mLJxeLgwkJBRzan7FFjiCXjv9nMj66SSDLra/ls= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 2DA5D3857830 for ; Wed, 18 May 2022 08:43:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DA5D3857830 Received: by mail-wm1-x334.google.com with SMTP id k126so710171wme.2 for ; Wed, 18 May 2022 01:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ntMo5FVDezApoURh+aQ+wp1CPY0N6wA+UxIxsmlw8qQ=; b=abruUiPTPaHnjd5zPqfnaVM/wjciUA5FzZtmztgrkzM4eyWEn2lGBFHoe4l37R1Ymp MoTgHD7CqT7LDvqBh20keNaRy5btmcBQrVS3G028S2GZH1KfYwr3/RLvEkwwtdLwvcDh IrL6pEV9EoWMwtS7/M8meBjWQtdIxgJkbW7GyZVKk8X92IpHd+VDgvJRuuYo4q6VRmKr TlWw5COj3ONNuOuAy81op7PYmZuOb8dJP6BDQzpja1dXs7yQyG37dyO+kfAdd9SVGizq DQoHY1dfyXS6kCzax5xvgMJlIr3YMxjW46HpUGt3SKuwb9yA+lusVV3iguk0MpBu/qDh mghQ== X-Gm-Message-State: AOAM532LGyhfe6MLpMuT/4Q6uC8H85KCa68X+2aJNfl8KIEdgT4auH77 hpoWOsBCceir936kFPNl6DfegcOzBszpFA== X-Google-Smtp-Source: ABdhPJz1FejhN9jKrUZ+JGlbLMWwXwkXN7OPvkVcD3wFEYbturMRz7CiewQYRKdYzPe3Uc9gOQogkQ== X-Received: by 2002:a05:600c:1e83:b0:395:b8e8:d256 with SMTP id be3-20020a05600c1e8300b00395b8e8d256mr24987855wmb.134.1652863383937; Wed, 18 May 2022 01:43:03 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id r18-20020a05600c159200b003949dbc3790sm1086008wmf.18.2022.05.18.01.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 01:43:03 -0700 (PDT) Date: Wed, 18 May 2022 08:43:02 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix incorrect freezing with generic child unit Message-ID: <20220518084302.GA3294266@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" The Analyze_Associations.Check_Generic_Parent function was using an incorrect node as the instanciation node for the actual, possibly leading to incorrect freeze node being created (and later crashing in gigi). Using Get_Unit_Instantiation_Node fixes the issue. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch12.adb (Check_Generic_Parent): Use Get_Unit_Instantiation_Node instead of Next. diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -1164,7 +1164,7 @@ package body Sem_Ch12 is function Matching_Actual (F : Entity_Id; A_F : Entity_Id) return Node_Id; - -- Find actual that corresponds to a given a formal parameter. If the + -- Find actual that corresponds to a given formal parameter. If the -- actuals are positional, return the next one, if any. If the actuals -- are named, scan the parameter associations to find the right one. -- A_F is the corresponding entity in the analyzed generic, which is @@ -2063,7 +2063,7 @@ package body Sem_Ch12 is procedure Check_Generic_Parent is Inst : constant Node_Id := - Next (Unit_Declaration_Node (Actual)); + Get_Unit_Instantiation_Node (Actual); Par : Entity_Id; begin