From 626ab89ada824ff6c4ab3436972a1e9707f6f5ef Mon Sep 17 00:00:00 2001 From: charlet Date: Wed, 15 Feb 2006 09:31:40 +0000 Subject: 2006-02-13 Richard Kenner Olivier Hainque Eric Botcazou * 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) : 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) : 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111030 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/utils2.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'gcc/ada/utils2.c') diff --git a/gcc/ada/utils2.c b/gcc/ada/utils2.c index f9d87dc1335..4f38e15fdf3 100644 --- a/gcc/ada/utils2.c +++ b/gcc/ada/utils2.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- * @@ -232,8 +232,12 @@ find_common_type (tree t1, tree t2) else if (TYPE_MODE (t2) != BLKmode) return t2; - /* Otherwise, return the type that has a constant size. */ - if (TREE_CONSTANT (TYPE_SIZE (t1))) + /* If both types have constant size, use the smaller one. */ + if (TREE_CONSTANT (TYPE_SIZE (t1)) && TREE_CONSTANT (TYPE_SIZE (t2))) + return tree_int_cst_lt (TYPE_SIZE (t1), TYPE_SIZE (t2)) ? t1 : t2; + + /* Otherwise, if either type has a constant size, use it. */ + else if (TREE_CONSTANT (TYPE_SIZE (t1))) return t1; else if (TREE_CONSTANT (TYPE_SIZE (t2))) return t2; @@ -1617,7 +1621,8 @@ build_simple_component_ref (tree record_variable, tree component, for (new_field = TYPE_FIELDS (record_type); new_field; new_field = TREE_CHAIN (new_field)) - if (DECL_ORIGINAL_FIELD (new_field) == field + if (field == new_field + || DECL_ORIGINAL_FIELD (new_field) == field || new_field == DECL_ORIGINAL_FIELD (field) || (DECL_ORIGINAL_FIELD (field) && (DECL_ORIGINAL_FIELD (field) -- cgit v1.2.1