diff options
author | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-01 07:43:09 +0000 |
---|---|---|
committer | ebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-06-01 07:43:09 +0000 |
commit | c70df25e22cac0aadd8693ce8c9f47366e76f28d (patch) | |
tree | 48929d331a115d7eb4d733c54e68da63d015f2da /gcc/ada/gcc-interface/utils.c | |
parent | dd46faa684becf70fbadda057aa6b5a854af29ba (diff) |
* gcc-interface/gigi.h (build_simple_component_ref): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
address clause on aliased object with unconstrained nominal subtype.
Mark the aligning variable as artificial, do not convert the address
expression immediately but mark it as constant instead.
* gcc-interface/utils.c (convert): If the target type contains a
template, be prepared for an empty array.
(maybe_unconstrained_array): Likewise.
* gcc-interface/utils2.c (known_alignment) <POINTER_PLUS_EXPR>: Deal
with the pattern built for aligning types.
<INTEGER_CST>: Do not cap the value at BIGGEST_ALIGNMENT.
(build_simple_component_ref): Make public.
If the base object is a constructor that contains a template, fold the
result field by field.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@223912 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r-- | gcc/ada/gcc-interface/utils.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 0871c3cbe3b4..31bb3d254ed9 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -4092,8 +4092,9 @@ convert (tree type, tree expr) CONSTRUCTOR_APPEND_ELT (v, TYPE_FIELDS (type), build_template (TREE_TYPE (TYPE_FIELDS (type)), obj_type, NULL_TREE)); - CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (type)), - convert (obj_type, expr)); + if (expr) + CONSTRUCTOR_APPEND_ELT (v, DECL_CHAIN (TYPE_FIELDS (type)), + convert (obj_type, expr)); return gnat_build_constructor (type, v); } @@ -4699,14 +4700,13 @@ maybe_unconstrained_array (tree exp) if (TYPE_CONTAINS_TEMPLATE_P (type)) { - exp = build_component_ref (exp, NULL_TREE, - DECL_CHAIN (TYPE_FIELDS (type)), - false); - type = TREE_TYPE (exp); + exp = build_simple_component_ref (exp, NULL_TREE, + DECL_CHAIN (TYPE_FIELDS (type)), + false); /* If the array type is padded, convert to the unpadded type. */ - if (TYPE_IS_PADDING_P (type)) - exp = convert (TREE_TYPE (TYPE_FIELDS (type)), exp); + if (exp && TYPE_IS_PADDING_P (TREE_TYPE (exp))) + exp = convert (TREE_TYPE (TYPE_FIELDS (TREE_TYPE (exp))), exp); } break; |