summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-06 11:13:32 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2012-05-06 11:13:32 +0000
commit647b284327a48bc9ff049348e9dd2584b7169cb4 (patch)
treed3f9fbbe4ae9a17c6fc5fd48ac3f5c9719ddcc4f /gcc/ada/gcc-interface/decl.c
parent7e48d3e686ad76457648061de51cbb577f965b1b (diff)
downloadgcc-647b284327a48bc9ff049348e9dd2584b7169cb4.tar.gz
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: In the renaming
case, use the padded type if the renamed object has an unconstrained type with default discriminant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@187209 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r--gcc/ada/gcc-interface/decl.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index ee96dbe4545..97ade5e6159 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -938,6 +938,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
gnu_type = TREE_TYPE (gnu_expr);
}
+ /* Or else, if the renamed object has an unconstrained type with
+ default discriminant, use the padded type. */
+ else if (TYPE_IS_PADDING_P (TREE_TYPE (gnu_expr))
+ && TREE_TYPE (TYPE_FIELDS (TREE_TYPE (gnu_expr)))
+ == gnu_type
+ && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (gnu_type)))
+ gnu_type = TREE_TYPE (gnu_expr);
+
/* Case 1: If this is a constant renaming stemming from a function
call, treat it as a normal object whose initial value is what
is being renamed. RM 3.3 says that the result of evaluating a