This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix error message printed for invalid access to atomic component


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: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]