From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 2F0653857C64 for ; Fri, 4 Nov 2022 13:53:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2F0653857C64 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-x434.google.com with SMTP id l14so7182299wrw.2 for ; Fri, 04 Nov 2022 06:53:59 -0700 (PDT) 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=n6Lj1hLtX2elKAkEbZL7llhwxf002qfPtFG6CHoKyvQ=; b=h/6r/swo/TGy7pVIvkcPrBGus8ZaWIsra95mqVQa5Yzy6bVKNApfvMK5mfgkYtk8it +q6w36JQM7IuxJ5z8c7Kxq8HkhqNJwpdnUA3THi42mJg3CqEfvaePriVJJ8M2hGpzuol FQhxjswxykUu0yt0xZqTQZxWl2jTsufs8+iIVsLhLJ+Bh8YWAFdP0lt6DXNnZBBRRYH1 cAEKBH97LII82Vub/DamGFDMuiCVoq7Hm4IZhbskmZwwDamD7AJ8vMktR4u0MzaKO9IR GGvvfWeE6DwANU4m2tB31eX8c3/w1FMn1ktWPQlLdoiuVJJ3xnhBsvJzCOEw9XsE6fw/ QHJQ== 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=n6Lj1hLtX2elKAkEbZL7llhwxf002qfPtFG6CHoKyvQ=; b=zPehrPKDm8NBvxve4AmKp3Rj46Ed32FiE+Q/g1rgSlhh+cdSInmZ4O6knkMvZowYjb k3WZMjxHIAIEzxOXd96nAH9Q1HEXO4ZW7dwRR7PWHeMQCtqvz5FuutyS2cFw7BF6LQcy 19HufwEe6b7KaHo1FvK6iELiZkRRXHqz6snFQfYM53Sg5loBY5LUPcla9bCo27FM6+eC dq7Vnuph5HFyiqUoaKvH39LWqnuFp6kJJTiGP67UMwy9Q92YWUc4GNZOehni0IBDdJAw 0SqfpUA2r8Sr3jgtvPB+Jl3P7LY/44ONqPCTmiHYw2/oq0Qe/XEppaTZDItNR9oc4RlA SqHg== X-Gm-Message-State: ACrzQf0lW0okssGQB2THh5S32mlz13KkYM3bUKoOhcqWkIeebc6VtyZK mRAFccHLP4fLYHz5dIu3DAxJQMtFi5OdzA== X-Google-Smtp-Source: AMsMyM6aeJVb6LRnM5CZGPZRXjM/PlCPSIx2/T9kOCzanBwZ43KDigXBPJXU2295i3sNLqwaieAOcQ== X-Received: by 2002:adf:e3cc:0:b0:235:95b1:2124 with SMTP id k12-20020adfe3cc000000b0023595b12124mr22988779wrm.693.1667570037941; Fri, 04 Nov 2022 06:53:57 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id j15-20020a05600c1c0f00b003c21ba7d7d6sm3114099wms.44.2022.11.04.06.53.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:53:57 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [COMMITTED] ada: Reject expanded global names in lock-free protected objects Date: Fri, 4 Nov 2022 14:53:47 +0100 Message-Id: <20221104135347.85341-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.2 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 Lock-free expansion of protected subprograms is only possible when there are no references to global assignable objects. We only detected such references when they appeared as direct names, but we must similarly detect expanded names. gcc/ada/ * sem_ch9.adb (Satisfies_Lock_Free_Requirements): Detect references via expanded names. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch9.adb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_ch9.adb b/gcc/ada/sem_ch9.adb index f2a59017865..5dee216256c 100644 --- a/gcc/ada/sem_ch9.adb +++ b/gcc/ada/sem_ch9.adb @@ -463,7 +463,7 @@ package body Sem_Ch9 is -- References - elsif Kind = N_Identifier + elsif Kind in N_Identifier | N_Expanded_Name and then Present (Entity (N)) then declare @@ -564,7 +564,7 @@ package body Sem_Ch9 is -- reference only one component of the protected type, plus -- the type of the component must support atomic operation. - if Kind = N_Identifier + if Kind in N_Identifier | N_Expanded_Name and then Present (Entity (N)) then declare -- 2.34.1