OSDN Git Service

* gcc-interface/decl.c (check_ok_for_atomic): Do nothing if the type
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Oct 2009 20:16:18 +0000 (20:16 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 2 Oct 2009 20:16:18 +0000 (20:16 +0000)
doesn't come from source.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152418 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/atomic2.adb [new file with mode: 0644]

index 967e4f0..1a86ebd 100644 (file)
@@ -1,5 +1,10 @@
 2009-10-02  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gcc-interface/decl.c (check_ok_for_atomic): Do nothing if the type
+       doesn't come from source.
+
+2009-10-02  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gcc-interface/decl.c (gnat_to_gnu_component_type): Force at least
        unit size for the component size of an array with aliased components.
        (maybe_pad_type): Do not warn for MAX_EXPR.
index 22ee89e..a6c1672 100644 (file)
@@ -7868,6 +7868,11 @@ check_ok_for_atomic (tree object, Entity_Id gnat_entity, bool comp_p)
      OBJECT is either a type or a decl.  */
   if (TYPE_P (object))
     {
+      /* If this is an anonymous base type, nothing to check.  Error will be
+        reported on the source type.  */
+      if (!Comes_From_Source (gnat_entity))
+       return;
+
       mode = TYPE_MODE (object);
       align = TYPE_ALIGN (object);
       size = TYPE_SIZE (object);
index f2dba40..e40e71d 100644 (file)
@@ -1,5 +1,9 @@
 2009-10-02  Eric Botcazou  <ebotcazou@adacore.com>
 
+       * gnat.dg/atomic2.adb: New test.
+
+2009-10-02  Eric Botcazou  <ebotcazou@adacore.com>
+
        * gnat.dg/array11.adb: New test.
        * gnat.dg/array12.adb: Likewise.
 
diff --git a/gcc/testsuite/gnat.dg/atomic2.adb b/gcc/testsuite/gnat.dg/atomic2.adb
new file mode 100644 (file)
index 0000000..c14d21e
--- /dev/null
@@ -0,0 +1,11 @@
+-- { dg-do compile }
+
+procedure Atomic2 is
+
+  type Big is array (1..4) of Integer;
+  type Arr is array (1..10) of Big;
+  pragma Atomic_Components (Arr); -- { dg-warning "cannot be guaranteed" }
+
+begin
+  null;
+end;