* [Ada] Fix error message printed for invalid access to atomic component
@ 2012-06-12 9:03 Arnaud Charlet
0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2012-06-12 9:03 UTC (permalink / raw)
To: gcc-patches; +Cc: Eric Botcazou
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
This changes the error message printed for an invalid access to an atomic
component, which was:
access to volatile object cannot yield access-to-non-volatile type
into the more correct:
access to atomic object cannot yield access-to-non-atomic type
The problem was that Is_Atomic_Object returned false for such a component.
The following testcase should generate the new error message:
procedure Atomic_Test is
type X32 is mod 2 ** 32;
type Rec is record
B : aliased X32;
pragma Atomic (B);
end record;
procedure Test (X : access X32) is null;
Object : Rec;
begin
Test (Object.B'Access);
end Atomic_Test;
Tested on x86_64-pc-linux-gnu, committed on trunk
2012-06-12 Eric Botcazou <ebotcazou@adacore.com>
* sem_util.adb (Is_Atomic_Object): Return true for an atomic
component as well as a prefix which is an atomic component.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 796 bytes --]
Index: sem_util.adb
===================================================================
--- sem_util.adb (revision 188428)
+++ sem_util.adb (working copy)
@@ -6749,6 +6749,11 @@
then
return True;
+ elsif Nkind (N) = N_Selected_Component
+ and then Is_Atomic (Entity (Selector_Name (N)))
+ then
+ return True;
+
elsif Nkind (N) = N_Indexed_Component
or else Nkind (N) = N_Selected_Component
then
@@ -6772,6 +6777,11 @@
then
return True;
+ elsif Nkind (N) = N_Selected_Component
+ and then Is_Atomic (Entity (Selector_Name (N)))
+ then
+ return True;
+
elsif Nkind (N) = N_Indexed_Component
or else Nkind (N) = N_Selected_Component
then
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2012-06-12 9:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-12 9:03 [Ada] Fix error message printed for invalid access to atomic component Arnaud Charlet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).