[Ada] Fix PR ada/83535

Message ID 3982071.vZeLixNyQr@polaris
State New
Headers show
Series
  • [Ada] Fix PR ada/83535
Related show

Commit Message

Eric Botcazou Dec. 21, 2017, 10:02 p.m.
This is a regression recently introduced on the mainline: the compiler doesn't 
use the specified size to access an atomic variable with an address clause.

Tested on x86_64-suse-linux, applied on the mainline.


2017-12-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Always take
	into account the Esize if it is known.


2017-12-21  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/atomic9.adb: New test.

-- 
Eric Botcazou

Patch

Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 255854)
+++ gcc-interface/decl.c	(working copy)
@@ -723,7 +723,7 @@  gnat_to_gnu_entity (Entity_Id gnat_entit
 				      TYPE_ALIGN (gnu_type));
 
 	/* Likewise, if a size is specified, use it if valid.  */
-	if (Known_Esize (gnat_entity) && No (Address_Clause (gnat_entity)))
+	if (Known_Esize (gnat_entity))
 	  gnu_size
 	    = validate_size (Esize (gnat_entity), gnu_type, gnat_entity,
 			     VAR_DECL, false, Has_Size_Clause (gnat_entity));