From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id C149A3857B9A for ; Mon, 7 Nov 2022 08:40:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C149A3857B9A 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-x42e.google.com with SMTP id k8so15088206wrh.1 for ; Mon, 07 Nov 2022 00:40:58 -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=0NKWJDxY9YNBmqepM195ojM+vIYhS02RbRJIZu37w8Q=; b=k1WB0AJ/yVmJWCM2H8qrhGk6lfZBpn6ssv+hmgIcIZhMxS4QOjcDF/gVfhz/I8fZwf nZEaXCQNhI1d+AHTHNs0m0/C1lMXTCfvB8EY6DQI0aMFcdys1etTsWMKVoB/qAB6sNmB V9ef89mHq1zKJkfsP9BLkuOaYe88atvwrGzaEJAVJZUuxaX/ZkoRMb9sfiJ26mDIdW5y jPw5+c3fAcMkphfXB1N5V8aj16Uygu0E/8RG24gYqE9pwrhSYBK266vXrsRTVUTwOBvf E5Ds/OCxps4V4JPJLpAqc62OZCFOQ2jgsGg4rs43s2jagLEs2vSrXReIgeqcrO+wvHtd y5wg== 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=0NKWJDxY9YNBmqepM195ojM+vIYhS02RbRJIZu37w8Q=; b=l6a6+7PJsJNtZp28cT1rhr9Bir7rEBmB3YSn2Acy8MBSjDIOcULnsbus2YIcqQ9k3h CQ7GVVNlor87f4O4uOJWitl9Is5Pk0vpmNg0RmN8r6YAqSSqJP6nLFiyZ+VYw4iMmFQj uGF4e378Mx2An1kNNVYR/qWTECWscqzTe7fsskaA3JlELtY9xQj7GGboxpLDRE3UQ1wo WzjaPEzIWYvtuDj156ZgQeUwY2UPSZcB4sOzuNg5kg7UMuw6R3i5uuHQFiiI2UcccWTJ Jg32sahTHOMhpD2CO+ptKEfX39Umzc2yl0petaVac7OQjc54ZmMtueVUqWS3IFU3b7xN d3KA== X-Gm-Message-State: ACrzQf2ts71bacROSRaEchNVzxrEED9yQJfosNIb2WhxAMxO+QBh3O3f sP0sCXD+iBJQz2TI7Na4nxdkGVoPfAWBhg== X-Google-Smtp-Source: AMsMyM4bA+nS/m5BQ7aDFKolWgwBSRycBiXKUIBWkv3DY5nvZq3nDdqy0uVF61dlc7USfodPnrxnxw== X-Received: by 2002:a5d:690a:0:b0:22c:dd11:7cac with SMTP id t10-20020a5d690a000000b0022cdd117cacmr524880wru.205.1667810457657; Mon, 07 Nov 2022 00:40:57 -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 bn9-20020a056000060900b00228cd9f6349sm6628848wrb.106.2022.11.07.00.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Nov 2022 00:40:57 -0800 (PST) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Fix detection of external calls to protected objects in instances Date: Mon, 7 Nov 2022 09:40:55 +0100 Message-Id: <20221107084055.151501-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.4 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: From: Piotr Trojanek Detection of external-vs-internal calls to protected objects relied on the scope stack. This didn't work when the call appeared in an instance of generic unit, because instances are analyzed in different context to where they appear. gcc/ada/ * exp_ch6.adb (Expand_Protected_Subprogram_Call): Examine scope tree and not the scope stack. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch6.adb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index 9380f3dab0f..0fa97688c5b 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -6240,7 +6240,7 @@ package body Exp_Ch6 is -- The object may be a component of some other data structure, in which -- case this must be handled as an inter-object call. - if not In_Open_Scopes (Scop) + if not Scope_Within_Or_Same (Inner => Current_Scope, Outer => Scop) or else Is_Entry_Wrapper (Current_Scope) or else not Is_Entity_Name (Name (N)) then -- 2.34.1