decl.c (gnat_to_gnu_entity): Test the underlying type.
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 7 Apr 2009 10:58:37 +0000 (10:58 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Tue, 7 Apr 2009 10:58:37 +0000 (10:58 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Test the
underlying type.
* gcc-interface/trans.c (lvalue_required_p): Likewise.

From-SVN: r145663

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

index d0a953d6146b4d80e149dc7a800cfb252fffdeda..d2a58c371eca276199ab138cc4a85e13e7ce4605 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-07  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: Test the
+       underlying type.
+       * gcc-interface/trans.c (lvalue_required_p): Likewise.
+
 2009-04-07  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/trans.c (Attribute_to_gnu) <Max_Size_In_Storage_Elmts>:
index 6cf616e961ba21c6ff4d9cddfc991147e0e72e13..5984027e96498d5cf2ff07c84e27783419be13f4 100644 (file)
@@ -886,7 +886,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                /* Case 3: If this is a constant renaming and creating a
                   new object is allowed and cheap, treat it as a normal
                   object whose initial value is what is being renamed.  */
-               if (const_flag && Is_Elementary_Type (Etype (gnat_entity)))
+               if (const_flag
+                   && !Is_Composite_Type
+                       (Underlying_Type (Etype (gnat_entity))))
                  ;
 
                /* Case 4: Make this into a constant pointer to the object we
index b505c887b6cf47ecae6cc17984e05a4384be9b1a..309617d35d195681431159337e695d8799705009 100644 (file)
@@ -730,7 +730,8 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, int aliased)
         attached to the CONST_DECL.  */
       return (aliased != 0
              /* This should match the constant case of the renaming code.  */
-             || Is_Composite_Type (Etype (Name (gnat_parent)))
+             || Is_Composite_Type
+                (Underlying_Type (Etype (Name (gnat_parent))))
              || Nkind (Name (gnat_parent)) == N_Identifier);
 
     default: