diff options
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/trans.c | 15 |
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b835918..7e1c7bc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2012-11-23 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/trans.c (Attribute_to_gnu) <Attr_Length>: Look through + a view conversion from constrained to unconstrained form. + +2012-11-23 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/decl.c (components_need_strict_alignment): New. (components_to_record): Do not pack the variants if one of the fields needs strict alignment. Likewise for the variant part as a whole. diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 52e525d..7194129 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -1700,7 +1700,20 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) gnat_param = Entity (Prefix (gnat_prefix)); } - gnu_type = TREE_TYPE (gnu_prefix); + /* If the prefix is the view conversion of a constrained array to an + unconstrained form, we retrieve the constrained array because we + might not be able to substitute the PLACEHOLDER_EXPR coming from + the conversion. This can occur with the 'Old attribute applied + to a parameter with an unconstrained type, which gets rewritten + into a constrained local variable very late in the game. */ + if (TREE_CODE (gnu_prefix) == VIEW_CONVERT_EXPR + && CONTAINS_PLACEHOLDER_P (TYPE_SIZE (TREE_TYPE (gnu_prefix))) + && !CONTAINS_PLACEHOLDER_P + (TYPE_SIZE (TREE_TYPE (TREE_OPERAND (gnu_prefix, 0))))) + gnu_type = TREE_TYPE (TREE_OPERAND (gnu_prefix, 0)); + else + gnu_type = TREE_TYPE (gnu_prefix); + prefix_unused = true; gnu_result_type = get_unpadded_type (Etype (gnat_node)); |