From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2066) id 8B7263973045; Wed, 10 Jun 2020 03:45:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B7263973045 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1591760723; bh=9ZJoAVpU6QnWLfX2k3TcTx7XgLbPwwi5FSoOgPLWGNk=; h=From:To:Subject:Date:From; b=cHP+9GcjJnuk9lGxnqeCBvx9dEhzHjstkbLxuCm9Op8T61vf/O6J61vThj2UanZu0 j8uZZORd2RHb928qlzEJWu0kh72X89s/vpInR+EGYANHjs4y2W0okcYAlo1mY447gk vpWG0swR7qTx8uGjdWqvR3yeYd6Kca+zisOsiSZg= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Jiu Fu Guo To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/guojiufu/heads/personal-branch)] [Ada] Do not warn on partial access to atomic object with address clause X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/users/guojiufu/heads/personal-branch X-Git-Oldrev: 591bdee0fa1087daeab3c0f901d5139c6776469d X-Git-Newrev: 8214938ab2e0775ff70b344a8fbc0a43bda0b0c5 Message-Id: <20200610034523.8B7263973045@sourceware.org> Date: Wed, 10 Jun 2020 03:45:23 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2020 03:45:23 -0000 https://gcc.gnu.org/g:8214938ab2e0775ff70b344a8fbc0a43bda0b0c5 commit 8214938ab2e0775ff70b344a8fbc0a43bda0b0c5 Author: Eric Botcazou Date: Sat Feb 15 16:48:15 2020 +0100 [Ada] Do not warn on partial access to atomic object with address clause 2020-06-08 Eric Botcazou gcc/ada/ * sem_res.adb (Resolve_Indexed_Component): Do not give a warning for a nonatomic component of an atomic array which is subject to an address clause in Ada 2020 mode. (Resolve_Selected_Component): Likewise for an atomic record. Diff: --- gcc/ada/sem_res.adb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb index 2cbb35f1519..303f4dbad4a 100644 --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -9034,10 +9034,10 @@ package body Sem_Res is Eval_Indexed_Component (N); end if; - -- If the array type is atomic, and the component is not atomic, then - -- this is worth a warning, since we have a situation where the access - -- to the component may cause extra read/writes of the atomic array - -- object, or partial word accesses, which could be unexpected. + -- If the array type is atomic and the component is not, then this is + -- worth a warning before Ada 2020, since we have a situation where the + -- access to the component may cause extra read/writes of the atomic + -- object, or partial word accesses, both of which may be unexpected. if Nkind (N) = N_Indexed_Component and then Is_Atomic_Ref_With_Address (N) @@ -9046,6 +9046,7 @@ package body Sem_Res is and then Has_Atomic_Components (Entity (Prefix (N))))) and then not Is_Atomic (Component_Type (Array_Type)) + and then Ada_Version < Ada_2020 then Error_Msg_N ("??access to non-atomic component of atomic array", Prefix (N)); @@ -10727,15 +10728,16 @@ package body Sem_Res is -- Note: No Eval processing is required, because the prefix is of a -- record type, or protected type, and neither can possibly be static. - -- If the record type is atomic, and the component is non-atomic, then - -- this is worth a warning, since we have a situation where the access - -- to the component may cause extra read/writes of the atomic array + -- If the record type is atomic and the component is not, then this is + -- worth a warning before Ada 2020, since we have a situation where the + -- access to the component may cause extra read/writes of the atomic -- object, or partial word accesses, both of which may be unexpected. if Nkind (N) = N_Selected_Component and then Is_Atomic_Ref_With_Address (N) and then not Is_Atomic (Entity (S)) and then not Is_Atomic (Etype (Entity (S))) + and then Ada_Version < Ada_2020 then Error_Msg_N ("??access to non-atomic component of atomic record",