This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Ada] Remove propagation of atomicity from object to type
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Arnaud Charlet <charlet at adacore dot com>
- Date: Wed, 27 May 2015 19:59:44 +0200
- Subject: Re: [Ada] Remove propagation of atomicity from object to type
- Authentication-results: sourceware.org; auth=none
- References: <20150527132000 dot GA16388 at adacore dot com>
> This trick is now obsolete since gigi should be able to rewrite the type of
> the objects to meet the atomicity requirements on its own.
It just needs the following patchlet, applied on the mainline.
2015-05-27 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Move down
code applying atomic checks to the object.
--
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c (revision 223766)
+++ gcc-interface/decl.c (working copy)
@@ -881,15 +881,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
check_ok_for_atomic_type (gnu_inner, gnat_entity, true);
}
- /* Now check if the type of the object allows atomic access. Note
- that we must test the type, even if this object has size and
- alignment to allow such access, because we will be going inside
- the padded record to assign to the object. We could fix this by
- always copying via an intermediate value, but it's not clear it's
- worth the effort. */
- if (Is_Atomic_Or_VFA (gnat_entity))
- check_ok_for_atomic_type (gnu_type, gnat_entity, false);
-
/* If this is an aliased object with an unconstrained nominal subtype,
make a type that includes the template. */
if (Is_Constr_Subt_For_UN_Aliased (Etype (gnat_entity))
@@ -955,6 +946,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
debug_info_p, gnat_entity);
}
+ /* Now check if the type of the object allows atomic access. */
+ if (Is_Atomic_Or_VFA (gnat_entity))
+ check_ok_for_atomic_type (gnu_type, gnat_entity, false);
+
/* If this is a renaming, avoid as much as possible to create a new
object. However, in some cases, creating it is required because
renaming can be applied to objects that are not names in Ada.