From: Eric Botcazou Date: Mon, 16 Dec 2019 10:33:59 +0000 (+0000) Subject: [Ada] Expand renamings of subcomponents of an atomic or VFA object X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9c9535f974cb9a348fd99a90d0ab08a32583d337;p=gcc.git [Ada] Expand renamings of subcomponents of an atomic or VFA object 2019-12-16 Eric Botcazou gcc/ada/ * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Document third special case of renamings requiring special handling. (Evaluation_Required): Return true for an atomic or VFA prefix. From-SVN: r279423 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e0f821b0a28..2151a4e60bd 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2019-12-16 Eric Botcazou + + * exp_ch8.adb (Expand_N_Object_Renaming_Declaration): Document + third special case of renamings requiring special handling. + (Evaluation_Required): Return true for an atomic or VFA prefix. + 2019-12-16 Ed Schonberg * checks.adb (Apply_Float_Conversion_Check): Use node of type diff --git a/gcc/ada/exp_ch8.adb b/gcc/ada/exp_ch8.adb index c3a77ed5adc..dcb51ef6533 100644 --- a/gcc/ada/exp_ch8.adb +++ b/gcc/ada/exp_ch8.adb @@ -72,7 +72,14 @@ package body Exp_Ch8 is -- clause applies (that can specify an arbitrary bit boundary), or where -- the enclosing record itself has a non-standard representation. - -- In these two cases, we pre-evaluate the renaming expression, by + -- In Ada 2020, a third case arises when the renamed object is a nonatomic + -- subcomponent of an atomic object, because reads of or writes to it must + -- access the enclosing atomic object. That's also the case for an object + -- subject to the Volatile_Full_Access GNAT aspect/pragma in any language + -- version. For the sake of simplicity, we treat any subcomponent of an + -- atomic or Volatile_Full_Access object in any language version this way. + + -- In these three cases, we pre-evaluate the renaming expression, by -- extracting and freezing the values of any subscripts, and then we -- set the flag Is_Renaming_Of_Object which means that any reference -- to the object will be handled by macro substitution in the front @@ -102,10 +109,10 @@ package body Exp_Ch8 is -- Determines whether it is necessary to do static name evaluation for -- renaming of Nam. It is considered necessary if evaluating the name -- involves indexing a packed array, or extracting a component of a - -- record to which a component clause applies. Note that we are only - -- interested in these operations if they occur as part of the name - -- itself, subscripts are just values that are computed as part of the - -- evaluation, so their form is unimportant. + -- record to which a component clause applies, or a subcomponent of an + -- atomic object. Note that we are only interested in these operations + -- if they occur as part of the name itself, subscripts are just values + -- that are computed as part of the evaluation, so they are unimportant. -- In addition, always return True for Modify_Tree_For_C since the -- code generator doesn't know how to handle renamings. @@ -121,6 +128,10 @@ package body Exp_Ch8 is elsif Nkind_In (Nam, N_Indexed_Component, N_Slice) then if Is_Packed (Etype (Prefix (Nam))) then return True; + + elsif Is_Atomic_Or_VFA_Object (Prefix (Nam)) then + return True; + else return Evaluation_Required (Prefix (Nam)); end if; @@ -141,6 +152,9 @@ package body Exp_Ch8 is then return True; + elsif Is_Atomic_Or_VFA_Object (Prefix (Nam)) then + return True; + else return Evaluation_Required (Prefix (Nam)); end if;