aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/utils.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2006-02-15 10:31:40 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2006-02-15 10:31:40 +0100
commit5b47742c2d278f8f8a4b1e02c6e1f786340da38f (patch)
tree1fd44711246a1ea895cf60b81987968b22bb417e /gcc/ada/utils.c
parent0022d9e31d01f2a31808ff38f66dd3e3ac96927a (diff)
downloadgcc-5b47742c2d278f8f8a4b1e02c6e1f786340da38f.zip
gcc-5b47742c2d278f8f8a4b1e02c6e1f786340da38f.tar.gz
gcc-5b47742c2d278f8f8a4b1e02c6e1f786340da38f.tar.bz2
re PR ada/26096 (Ada bootstrap fails in g-alleve.adb)
2006-02-13 Richard Kenner <kenner@vlsi1.ultra.nyu.edu> Olivier Hainque <hainque@adacore.com> Eric Botcazou <ebotcazou@adacore.com> * ada-tree.h: (TYPE_UNCHECKED_UNION_P): Deleted. * gigi.h (value_factor_p): Add prototype and description, now public. * decl.c (gnat_to_gnu_field): Don't attempt BLKmode to integral type promotion for field with rep clause if the associated size was proven to be in error. Expand comments describing attempts to use a packable type. (gnat_to_gnu_entity) <E_Signed_Integer_Subtype, E_Floating_Point_Subtype>: Inherit alias set of what we are making a subtype of to ensure conflicts amongst all subtypes in a hierarchy, necessary since these are not different types and pointers may actually designate any subtype in this hierarchy. (gnat_to_gnu_entity, case E_Record_Type): Always make fields for discriminants but put them into record only if not Unchecked_Union; pass flag to components_to_record showing Unchecked_Union. (make_dummy_type): Use UNION_TYPE only if Unchecked_Union and no components before variants; don't set TYPE_UNCHECKED_UNION_P. (components_to_record): New argument UNCHECKED_UNION. Remove special case code for Unchecked_Union and instead use main code with small changes. PR ada/26096 (gnat_to_gnu_entity) <E_Variable>: Do not initialize the aligning variable with the expression being built, only its inner field. * trans.c (Handled_Sequence_Of_Statements_to_gnu): Remove call to emit_sequence_entry_statements. (emit_sequence_entry_statements, body_with_handlers_p): Delete. (establish_gnat_vms_condition_handler): Move before Subprogram_Body_to_gnu. (Subprogram_Body_to_gnu): On VMS, establish_gnat_vms_condition_handler for a subprogram if it has a foreign convention or is exported. (Identifier_to_gnu): Manually unshare the DECL_INITIAL tree when it is substituted for a CONST_DECL. (tree_transform, case N_Aggregate): Remove code for UNION_TYPE and pass Etype to assoc_to_constructor. (assoc_to_constructor): New argument, GNAT_ENTITY; use it to ignore discriminants of Unchecked_Union. (TARGET_ABI_OPEN_VMS): Define to 0 if not defined, so that later uses don't need cluttering preprocessor directives. (establish_gnat_vms_condition_handler): New function. Establish the GNAT condition handler as current in the compiled function. (body_with_handlers_p): New function. Tell whether a given sequence of statements node is attached to a package or subprogram body and involves exception handlers possibly nested within inner block statements. (emit_sequence_entry_statements): New function, to emit special statements on entry of sequences when necessary. Establish GNAT condition handler in the proper cases for VMS. (Handled_Sequence_Of_Statements_to_gnu): Start block code with emit_sequence_entry_statements. * utils2.c (find_common_type): If both input types are BLKmode and have a constant size, use the smaller one. (build_simple_component_ref): Also match if FIELD and NEW_FIELD are the same. * utils.c (value_factor_p): Make public, to allow uses from other gigi units. (create_type_decl): Do not set the flag DECL_IGNORED_P for dummy types. (convert, case UNION_TYPE): Remove special treatment for unchecked unions. PR ada/18659 (update_pointer_to): Update variants of pointer types to unconstrained arrays by attaching the list of fields of the main variant. From-SVN: r111030
Diffstat (limited to 'gcc/ada/utils.c')
-rw-r--r--gcc/ada/utils.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/gcc/ada/utils.c b/gcc/ada/utils.c
index 0b499af..78c1237 100644
--- a/gcc/ada/utils.c
+++ b/gcc/ada/utils.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2005, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2006, Free Software Foundation, Inc. *
* *
* GNAT is free software; you can redistribute it and/or modify it under *
* terms of the GNU General Public License as published by the Free Soft- *
@@ -133,7 +133,6 @@ static tree float_type_for_precision (int, enum machine_mode);
static tree convert_to_fat_pointer (tree, tree);
static tree convert_to_thin_pointer (tree, tree);
static tree make_descriptor_field (const char *,tree, tree, tree);
-static bool value_factor_p (tree, HOST_WIDE_INT);
static bool potential_alignment_gap (tree, tree, tree);
/* Initialize the association of GNAT nodes to GCC trees. */
@@ -1215,9 +1214,10 @@ create_type_decl (tree type_name, tree type, struct attrib *attr_list,
/* Pass type declaration information to the debugger unless this is an
UNCONSTRAINED_ARRAY_TYPE, which the debugger does not support,
- and ENUMERAL_TYPE or RECORD_TYPE which is handled separately,
- a dummy type, which will be completed later, or a type for which
- debugging information was not requested. */
+ and ENUMERAL_TYPE or RECORD_TYPE which is handled separately, or
+ type for which debugging information was not requested. */
+ if (code == UNCONSTRAINED_ARRAY_TYPE || ! debug_info_p)
+ DECL_IGNORED_P (type_decl) = 1;
if (code == UNCONSTRAINED_ARRAY_TYPE || TYPE_IS_DUMMY_P (type)
|| !debug_info_p)
DECL_IGNORED_P (type_decl) = 1;
@@ -1573,7 +1573,7 @@ process_attributes (tree decl, struct attrib *attr_list)
/* Return true if VALUE is a known to be a multiple of FACTOR, which must be
a power of 2. */
-static bool
+bool
value_factor_p (tree value, HOST_WIDE_INT factor)
{
if (host_integerp (value, 1))
@@ -2471,7 +2471,8 @@ build_unc_object_type (tree template_type, tree object_type, tree name)
/* Same, taking a thin or fat pointer type instead of a template type. */
tree
-build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type, tree name)
+build_unc_object_type_from_ptr (tree thin_fat_ptr_type, tree object_type,
+ tree name)
{
tree template_type;
@@ -2592,7 +2593,13 @@ update_pointer_to (tree old_type, tree new_type)
TREE_CHAIN (TYPE_FIELDS (ptr)), new_ref));
for (var = TYPE_MAIN_VARIANT (ptr); var; var = TYPE_NEXT_VARIANT (var))
- SET_TYPE_UNCONSTRAINED_ARRAY (var, new_type);
+ {
+ SET_TYPE_UNCONSTRAINED_ARRAY (var, new_type);
+
+ /* This may seem a bit gross, in particular wrt DECL_CONTEXT, but
+ actually is in keeping with what build_qualified_type does. */
+ TYPE_FIELDS (var) = TYPE_FIELDS (ptr);
+ }
TYPE_POINTER_TO (new_type) = TYPE_REFERENCE_TO (new_type)
= TREE_TYPE (new_type) = ptr;
@@ -2722,7 +2729,6 @@ convert (tree type, tree expr)
enum tree_code code = TREE_CODE (type);
tree etype = TREE_TYPE (expr);
enum tree_code ecode = TREE_CODE (etype);
- tree tem;
/* If EXPR is already the right type, we are done. */
if (type == etype)
@@ -2892,11 +2898,9 @@ convert (tree type, tree expr)
return build1 (VIEW_CONVERT_EXPR, type, op0);
/* Otherwise, we may just bypass the input view conversion unless
- one of the types is a fat pointer, or we're converting to an
- unchecked union type. Both are handled by specialized code
- below and the latter relies on exact type matching. */
- else if (!TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype)
- && !(code == UNION_TYPE && TYPE_UNCHECKED_UNION_P (type)))
+ one of the types is a fat pointer, which is handled by
+ specialized code below which relies on exact type matching. */
+ else if (!TYPE_FAT_POINTER_P (type) && !TYPE_FAT_POINTER_P (etype))
return convert (type, op0);
}
}
@@ -3020,29 +3024,10 @@ convert (tree type, tree expr)
return unchecked_convert (type, expr, false);
case UNION_TYPE:
- /* For unchecked unions, just validate that the type is indeed that of
- a field of the type. Then make the simple conversion. */
- if (TYPE_UNCHECKED_UNION_P (type))
- {
- for (tem = TYPE_FIELDS (type); tem; tem = TREE_CHAIN (tem))
- {
- if (TREE_TYPE (tem) == etype)
- return build1 (CONVERT_EXPR, type, expr);
- else if (TREE_CODE (TREE_TYPE (tem)) == RECORD_TYPE
- && (TYPE_JUSTIFIED_MODULAR_P (TREE_TYPE (tem))
- || TYPE_IS_PADDING_P (TREE_TYPE (tem)))
- && TREE_TYPE (TYPE_FIELDS (TREE_TYPE (tem))) == etype)
- return build1 (CONVERT_EXPR, type,
- convert (TREE_TYPE (tem), expr));
- }
-
- gcc_unreachable ();
- }
- else
- /* Otherwise, this is a conversion between a tagged type and some
- subtype, which we have to mark as a UNION_TYPE because of
- overlapping fields. */
- return unchecked_convert (type, expr, false);
+ /* This is a either a conversion between a tagged type and some
+ subtype, which we have to mark as a UNION_TYPE because of
+ overlapping fields or a conversion of an Unchecked_Union. */
+ return unchecked_convert (type, expr, false);
case UNCONSTRAINED_ARRAY_TYPE:
/* If EXPR is a constrained array, take its address, convert it to a