decl.c (gnat_to_gnu_entity): Do not make constant objects covered by 13.3(19) volatile.
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 21 Apr 2009 07:10:01 +0000 (07:10 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 21 Apr 2009 07:10:01 +0000 (07:10 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Do not make
constant objects covered by 13.3(19) volatile.

From-SVN: r146468

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index 0e48f7848b1b26fcda921f21434804db06adedfc..d771e988a3e1973f01094464c38a19211199925d 100644 (file)
@@ -1,3 +1,8 @@
+2009-04-21  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Do not make
+       constant objects covered by 13.3(19) volatile.
+
 2009-04-21  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/utils.c (create_type_decl): Do not pass declarations
index 390d458f7017845f96e43bc0c0449728d18a545d..18ebeff76ab3039ab480643981667a6cd48a59ea 100644 (file)
@@ -967,15 +967,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
 
        /* Make a volatile version of this object's type if we are to make
           the object volatile.  We also interpret 13.3(19) conservatively
-          and disallow any optimizations for an object covered by it.  */
+          and disallow any optimizations for such a non-constant object.  */
        if ((Treat_As_Volatile (gnat_entity)
-            || (Is_Exported (gnat_entity)
-                /* Exclude exported constants created by the compiler,
-                   which should boil down to static dispatch tables and
-                   make it possible to put them in read-only memory.  */
-                && (Comes_From_Source (gnat_entity) || !const_flag))
-            || Is_Imported (gnat_entity)
-            || Present (Address_Clause (gnat_entity)))
+            || (!const_flag
+                && (Is_Exported (gnat_entity)
+                    || Is_Imported (gnat_entity)
+                    || Present (Address_Clause (gnat_entity)))))
            && !TYPE_VOLATILE (gnu_type))
          gnu_type = build_qualified_type (gnu_type,
                                           (TYPE_QUALS (gnu_type)