From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by sourceware.org (Postfix) with ESMTPS id A5806385B50F for ; Thu, 5 Jan 2023 14:40:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A5806385B50F Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x42b.google.com with SMTP id s9so4323570wru.13 for ; Thu, 05 Jan 2023 06:40:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Vuw36t5DVLBtO6xn0gOyP+YPUxlmqGxV/1tfTMVnCP0=; b=BFWrxHQv5MxiF9bCxQthjLVsCYAgla4qdVg7xDMj5VJnUzyPlNaQfrNDN/7OH0zO+U uiijsDlavurD0Xg/Zpi2cHwNAjGYWSQH/Mahiu5US+Ush/K2ZCnPvwv0QE0WZk+f7ftK 2crJjEUDMDBmyTHLVud1tVxxa1mJfyz47mJXiGT9csqnr2VqcKGl6mMy/O0Vb2UeP0xH Zr9IIv+kletbWuQkiWIgGP5pes2lCVoYwp08T46MVcKD7VH5NghbQyNNzRIXxPBHVVQI DOcxDq79Q2+1VdfgmtLhQKD8tiaoxkF1PWpBfleWQT4PvgE4muKVPwG1WdAGk8bgLy81 +Www== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=Vuw36t5DVLBtO6xn0gOyP+YPUxlmqGxV/1tfTMVnCP0=; b=7M9X19o/WjLn1ZzUjWs88OureENzVTMSIMWXD2aMpR9Jg1W2CleXp4CmjO7S9zpZ1u o7al2KL84cV8d5I4LYLhkTtha3ReWtnD5nINHUraYJcAroZL2JW6bnlYCyvivwPZ+/U+ gujIa97JZqeJkjFXdLNxGbiho3eR2qfDuffiQ0Tl1VQexykjIZsfs8YRB3Ip8FxN9XD/ IClyF/s4Qo8rvh72GHQIPbJlQeBApsXP6NLSHpgBUF5viIhQxQjni08C4xw4/Wl6JJW5 DWMwgHvqaAhjncp8X9lUC5IsMRfDjH4N1R7twSIsTAvaaX2iAlE+PHYWuPb6tpnH1PGo eBVQ== X-Gm-Message-State: AFqh2koos1VABR0WuW22v4IBisQ1Ql7a8Msjnn+N6ZQBl9HGkiSX+J3D MBr4USz6NKTCUO+ziPv36FyBVC8X9P/UlE58gCo= X-Google-Smtp-Source: AMrXdXuU2vr18u6tpFK82urDxrhIOBkMNgS9JJICuPjYhGaPCBEU4WyhQCTTSXxQmsz6I+kiiehCtg== X-Received: by 2002:adf:f54a:0:b0:242:73d5:d8cf with SMTP id j10-20020adff54a000000b0024273d5d8cfmr32083082wrp.32.1672929653532; Thu, 05 Jan 2023 06:40:53 -0800 (PST) Received: from poulhies-Precision-5550.lan (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id i14-20020a05600c354e00b003d1d5a83b2esm3066637wmq.35.2023.01.05.06.40.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Jan 2023 06:40:53 -0800 (PST) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= Subject: [COMMITTED] ada: Fix nested generic instantiation Date: Thu, 5 Jan 2023 15:40:51 +0100 Message-Id: <20230105144051.156381-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-13.6 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Previous fix for generic instantiation was not precise enough and could wrongly assume the instantiation node to be an N_Expanded_Name. gcc/ada/ * sem_ch12.adb (Instantiate_Package_Body): Better filtering when installing parent on the scope stack. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch12.adb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/ada/sem_ch12.adb b/gcc/ada/sem_ch12.adb index 0f2dd39b53c..1755549bd8b 100644 --- a/gcc/ada/sem_ch12.adb +++ b/gcc/ada/sem_ch12.adb @@ -12182,6 +12182,9 @@ package body Sem_Ch12 is elsif Ekind (Scope (Gen_Unit)) = E_Generic_Package and then Ekind (Scope (Act_Decl_Id)) = E_Package and then Is_Generic_Instance (Scope (Act_Decl_Id)) + and then Nkind + (Name (Get_Unit_Instantiation_Node + (Scope (Act_Decl_Id)))) = N_Expanded_Name then Par_Ent := Entity (Prefix (Name (Get_Unit_Instantiation_Node -- 2.34.1