summaryrefslogtreecommitdiff
path: root/gcc/ada/trans.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-08 10:30:06 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-08 10:30:06 +0000
commit4ec180c2cf5f1c95a8206063f57badd2aceffb1c (patch)
treee298e197d6ac93776440288b70e8a3888ecd21df /gcc/ada/trans.c
parentc4b95acc27fb6c2c59bd66fbf4d5d34a74ecb865 (diff)
downloadgcc-4ec180c2cf5f1c95a8206063f57badd2aceffb1c.tar.gz
* decl.c (gnat_to_gnu_entity) <Object>: Simplify the condition under
which a constant renaming is treated as a normal object declaration. * trans.c (lvalue_required_p) <N_Slice>: New case, extracted from the N_Indexed_Component case. <N_Indexed_Component>: Fall through to above case. <N_Object_Renaming_Declaration>: Return true for all composite types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128268 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/trans.c')
-rw-r--r--gcc/ada/trans.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index 24797753fd8..1a4067c8639 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -384,20 +384,28 @@ lvalue_required_p (Node_Id gnat_node, tree operand_type, int aliased)
gnat_temp = Next (gnat_temp))
if (Nkind (gnat_temp) != N_Integer_Literal)
return 1;
- aliased |= Has_Aliased_Components (Etype (Prefix (gnat_node)));
- return lvalue_required_p (Parent (gnat_node), operand_type, aliased);
}
+ /* ... fall through ... */
+
+ case N_Slice:
+ aliased |= Has_Aliased_Components (Etype (Prefix (gnat_node)));
+ return lvalue_required_p (Parent (gnat_node), operand_type, aliased);
+
case N_Selected_Component:
aliased |= Is_Aliased (Entity (Selector_Name (gnat_node)));
return lvalue_required_p (Parent (gnat_node), operand_type, aliased);
case N_Object_Renaming_Declaration:
/* We need to make a real renaming only if the constant object is
- aliased; otherwise we can optimize and return the rvalue. We
- make an exception if the object is an identifier since in this
- case the rvalue can be propagated attached to the CONST_DECL. */
- return aliased || Nkind (Name (gnat_node)) == N_Identifier;
+ aliased or if we may use a renaming pointer; otherwise we can
+ optimize and return the rvalue. We make an exception if the object
+ is an identifier since in this case the rvalue can be propagated
+ attached to the CONST_DECL. */
+ return (aliased != 0
+ /* This should match the constant case of the renaming code. */
+ || Is_Composite_Type (Etype (Name (gnat_node)))
+ || Nkind (Name (gnat_node)) == N_Identifier);
default:
return 0;