This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Ada] Fix PR ada/83535
- From: Eric Botcazou <ebotcazou at adacore dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 21 Dec 2017 23:02:58 +0100
- Subject: [Ada] Fix PR ada/83535
- Authentication-results: sourceware.org; auth=none
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
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));
-- { dg-do compile }
-- { dg-options "-fdump-tree-gimple" }
with Interfaces;
procedure Atomic9 is
Register : Interfaces.Unsigned_32;
type Interrupt_ID is range 0 .. 44;
procedure Trigger_Interrupt (IRQ : Interrupt_ID) is
NVIC_STIR : Interrupt_ID
with
Import,
Atomic,
Size => 32,
Address => Register'Address;
begin
NVIC_STIR := IRQ;
end Trigger_Interrupt;
begin
Register := 16#ffff_ffff#;
Trigger_Interrupt (1);
end;
-- { dg-final { scan-tree-dump "atomic_store_4" "gimple" } }