aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-06-01 07:43:09 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-06-01 07:43:09 +0000
commit73a1a803087a914aea66321618595bf6c9614d67 (patch)
tree48929d331a115d7eb4d733c54e68da63d015f2da /gcc/ada/gcc-interface/utils.c
parentfcdc67186be6960edfa1905abf8c208c4df3713a (diff)
downloadgcc-73a1a803087a914aea66321618595bf6c9614d67.zip
gcc-73a1a803087a914aea66321618595bf6c9614d67.tar.gz
gcc-73a1a803087a914aea66321618595bf6c9614d67.tar.bz2
gigi.h (build_simple_component_ref): Declare.
* 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. From-SVN: r223912
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 0871c3c..31bb3d2 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;