diff options
author | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-07-30 23:54:56 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2008-07-30 23:54:56 +0000 |
commit | 01ddebf20842e3e6b9b9349a2e68cd702bfcc27b (patch) | |
tree | 87a4eb9f676e3356453c46961c4ca3f72f9bd2a7 /gcc/ada/gcc-interface/decl.c | |
parent | b8c71e40e0eecc003533b7f294fbe2d29e641326 (diff) | |
download | gcc-01ddebf20842e3e6b9b9349a2e68cd702bfcc27b.zip gcc-01ddebf20842e3e6b9b9349a2e68cd702bfcc27b.tar.gz gcc-01ddebf20842e3e6b9b9349a2e68cd702bfcc27b.tar.bz2 |
re PR ada/36554 (verify_flow_info ICE can not throw but has EH edges)
PR ada/36554
* dwarf2out.c (is_subrange_type): Deal with BOOLEAN_TYPE.
ada/
* back_end.adb (Call_Back_End): Pass Standard_Boolean to gigi.
* gcc-interface/gigi.h (gigi): Take new standard_boolean parameter.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Enumeration_Subtype>:
Set precision to 1 for subtype of BOOLEAN_TYPE.
(set_rm_size): Set TYPE_RM_SIZE_NUM for BOOLEAN_TYPE.
(make_type_from_size): Deal with BOOLEAN_TYPE.
* gcc-interface/misc.c (gnat_print_type): Likewise.
* gcc-interface/trans.c (gigi): Take new standard_boolean parameter.
Set boolean_type_node as its translation in the table, as well
as boolean_false_node for False and boolean_true_node for True.
* gcc-interface/utils.c (gnat_init_decl_processing): Create custom
8-bit boolean_type_node and set its TYPE_RM_SIZE_NUM.
(create_param_decl): Deal with BOOLEAN_TYPE.
(build_vms_descriptor): Likewise.
(build_vms_descriptor64): Likewise.
(convert): Deal with BOOLEAN_TYPE like with ENUMERAL_TYPE.
From-SVN: r138348
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 61ae653..b02b9a0 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -1536,15 +1536,20 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnu_expr, 0); gnu_type = make_node (INTEGER_TYPE); + TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity)); + + /* Set the precision to the Esize except for bit-packed arrays and + subtypes of Standard.Boolean. */ if (Is_Packed_Array_Type (gnat_entity) && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))) { esize = UI_To_Int (RM_Size (gnat_entity)); TYPE_PACKED_ARRAY_TYPE_P (gnu_type) = 1; } + else if (TREE_CODE (TREE_TYPE (gnu_type)) == BOOLEAN_TYPE) + esize = 1; TYPE_PRECISION (gnu_type) = esize; - TREE_TYPE (gnu_type) = get_unpadded_type (Etype (gnat_entity)); TYPE_MIN_VALUE (gnu_type) = convert (TREE_TYPE (gnu_type), @@ -1596,7 +1601,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) are uninitialized. Both goals are accomplished by wrapping the modular value in an enclosing struct. */ if (Is_Packed_Array_Type (gnat_entity) - && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))) + && Is_Bit_Packed_Array (Original_Array_Type (gnat_entity))) { tree gnu_field_type = gnu_type; tree gnu_field; @@ -7106,7 +7111,8 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity) if (TREE_CODE (gnu_type) == INTEGER_TYPE && Is_Discrete_Or_Fixed_Point_Type (gnat_entity)) TYPE_RM_SIZE_NUM (gnu_type) = size; - else if (TREE_CODE (gnu_type) == ENUMERAL_TYPE) + else if (TREE_CODE (gnu_type) == ENUMERAL_TYPE + || TREE_CODE (gnu_type) == BOOLEAN_TYPE) TYPE_RM_SIZE_NUM (gnu_type) = size; else if ((TREE_CODE (gnu_type) == RECORD_TYPE || TREE_CODE (gnu_type) == UNION_TYPE @@ -7124,7 +7130,7 @@ static tree make_type_from_size (tree type, tree size_tree, bool for_biased) { unsigned HOST_WIDE_INT size; - bool biased_p; + bool biased_p, boolean_p; tree new_type; /* If size indicates an error, just return TYPE to avoid propagating @@ -7138,13 +7144,23 @@ make_type_from_size (tree type, tree size_tree, bool for_biased) { case INTEGER_TYPE: case ENUMERAL_TYPE: + case BOOLEAN_TYPE: biased_p = (TREE_CODE (type) == INTEGER_TYPE && TYPE_BIASED_REPRESENTATION_P (type)); + boolean_p = (TREE_CODE (type) == BOOLEAN_TYPE + || (TREE_CODE (type) == INTEGER_TYPE + && TREE_TYPE (type) + && TREE_CODE (TREE_TYPE (type)) == BOOLEAN_TYPE)); + + if (boolean_p) + size = round_up_to_align (size, BITS_PER_UNIT); + /* Only do something if the type is not a packed array type and doesn't already have the proper size. */ if (TYPE_PACKED_ARRAY_TYPE_P (type) - || (TYPE_PRECISION (type) == size && biased_p == for_biased)) + || (biased_p == for_biased && TYPE_PRECISION (type) == size) + || (boolean_p && compare_tree_int (TYPE_SIZE (type), size) == 0)) break; biased_p |= for_biased; @@ -7154,13 +7170,18 @@ make_type_from_size (tree type, tree size_tree, bool for_biased) new_type = make_unsigned_type (size); else new_type = make_signed_type (size); + if (boolean_p) + TYPE_PRECISION (new_type) = 1; TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type; TYPE_MIN_VALUE (new_type) = convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type)); TYPE_MAX_VALUE (new_type) = convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type)); TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p; - TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size); + if (boolean_p) + TYPE_RM_SIZE_NUM (new_type) = bitsize_int (1); + else + TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size); return new_type; case RECORD_TYPE: |