From 0e5b9de3128a989de7438db0930b9800e7e0f4c8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 21 Dec 2017 22:02:45 +0000 Subject: [PATCH] decl.c (gnat_to_gnu_entity): Always take into account the Esize if it is known. * gcc-interface/decl.c (gnat_to_gnu_entity) : Always take into account the Esize if it is known. From-SVN: r255958 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/gcc-interface/decl.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gnat.dg/atomic9.adb | 29 +++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gnat.dg/atomic9.adb diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 13a0c80e431..c95d1fc3cae 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2017-12-21 Eric Botcazou + + * gcc-interface/decl.c (gnat_to_gnu_entity) : Always take + into account the Esize if it is known. + 2017-12-21 Richard Sandiford Alan Hayward David Sherwood diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 20d35f3a5dc..ab5fb0e1a55 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -723,7 +723,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) 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)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 35752574666..a93c0ddf292 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2017-12-21 Eric Botcazou + + * gnat.dg/atomic9.adb: New test. + 2017-12-21 Jakub Jelinek PR rtl-optimization/80747 diff --git a/gcc/testsuite/gnat.dg/atomic9.adb b/gcc/testsuite/gnat.dg/atomic9.adb new file mode 100644 index 00000000000..1dab33cb40c --- /dev/null +++ b/gcc/testsuite/gnat.dg/atomic9.adb @@ -0,0 +1,29 @@ +-- { 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" } } -- 2.30.2