Commit 8005f3e5 by Richard Kenner Committed by Arnaud Charlet

cuintp.c, [...]: Use gcc_assert and gcc_unreachable.

2004-10-04  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* cuintp.c, decl.c, utils2.c: Use gcc_assert and gcc_unreachable.

	* trans.c (assoc_to_constructor): Fix unused var warning if no checking.
	(gnat_gimplify_expr, case ADDR_EXPR): Fix error in last change.
	Use gcc_assert and gcc_unreachable.

	* decl.c (gnat_to_gnu_entity, case object): Check and process a
	specified alignment before validating size.
	(gnat_to_gnu_entity) <E_Modular_Integer_Subtype>: Create a
	stripped-down declaration for the type of the inner field when making
	a JM type.

	* utils.c (finish_record_type): Do not compute the size in units
	incrementally. Instead compute it once for the rep clause case.
	Use gcc_assert and gcc_unreachable.

From-SVN: r88493
parent 6a294a29
2004-10-04 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* cuintp.c, decl.c, utils2.c: Use gcc_assert and gcc_unreachable.
* trans.c (assoc_to_constructor): Fix unused var warning if no checking.
(gnat_gimplify_expr, case ADDR_EXPR): Fix error in last change.
Use gcc_assert and gcc_unreachable.
* decl.c (gnat_to_gnu_entity, case object): Check and process a
specified alignment before validating size.
(gnat_to_gnu_entity) <E_Modular_Integer_Subtype>: Create a
stripped-down declaration for the type of the inner field when making
a JM type.
* utils.c (finish_record_type): Do not compute the size in units
incrementally. Instead compute it once for the rep clause case.
Use gcc_assert and gcc_unreachable.
2004-10-04 Vincent Celier <celier@gnat.com> 2004-10-04 Vincent Celier <celier@gnat.com>
* a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character * a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character
......
...@@ -89,9 +89,7 @@ UI_To_gnu (Uint Input, tree type) ...@@ -89,9 +89,7 @@ UI_To_gnu (Uint Input, tree type)
? type : integer_type_node); ? type : integer_type_node);
tree gnu_base = build_cst_from_int (comp_type, Base); tree gnu_base = build_cst_from_int (comp_type, Base);
if (Length <= 0) gcc_assert (Length > 0);
abort ();
gnu_ret = build_cst_from_int (comp_type, First); gnu_ret = build_cst_from_int (comp_type, First);
if (First < 0) if (First < 0)
for (Idx++, Length--; Length; Idx++, Length--) for (Idx++, Length--; Length; Idx++, Length--)
......
...@@ -117,9 +117,7 @@ gnat_to_gnu_type (Entity_Id gnat_entity) ...@@ -117,9 +117,7 @@ gnat_to_gnu_type (Entity_Id gnat_entity)
/* Convert the ada entity type into a GCC TYPE_DECL node. */ /* Convert the ada entity type into a GCC TYPE_DECL node. */
gnu_decl = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0); gnu_decl = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0);
if (TREE_CODE (gnu_decl) != TYPE_DECL) gcc_assert (TREE_CODE (gnu_decl) == TYPE_DECL);
abort ();
return TREE_TYPE (gnu_decl); return TREE_TYPE (gnu_decl);
} }
...@@ -226,12 +224,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -226,12 +224,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* This abort means the entity "gnat_entity" has an incorrect scope, /* This abort means the entity "gnat_entity" has an incorrect scope,
i.e. that its scope does not correspond to the subprogram in which i.e. that its scope does not correspond to the subprogram in which
it is declared */ it is declared */
abort (); gcc_unreachable ();
} }
/* If this is entity 0, something went badly wrong. */ /* If this is entity 0, something went badly wrong. */
if (No (gnat_entity)) gcc_assert (Present (gnat_entity));
abort ();
/* If we've already processed this entity, return what we got last time. /* If we've already processed this entity, return what we got last time.
If we are defining the node, we should not have already processed it. If we are defining the node, we should not have already processed it.
...@@ -262,19 +259,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -262,19 +259,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* If this is a numeric or enumeral type, or an access type, a nonzero /* If this is a numeric or enumeral type, or an access type, a nonzero
Esize must be specified unless it was specified by the programmer. */ Esize must be specified unless it was specified by the programmer. */
if ((IN (kind, Numeric_Kind) || IN (kind, Enumeration_Kind) gcc_assert (!Unknown_Esize (gnat_entity)
|| (IN (kind, Access_Kind) || Has_Size_Clause (gnat_entity)
&& kind != E_Access_Protected_Subprogram_Type || (!IN (kind, Numeric_Kind) && !IN (kind, Enumeration_Kind)
&& kind != E_Access_Subtype)) && (!IN (kind, Access_Kind)
&& Unknown_Esize (gnat_entity) || kind == E_Access_Protected_Subprogram_Type
&& !Has_Size_Clause (gnat_entity)) || kind == E_Access_Subtype)));
abort ();
/* Likewise, RM_Size must be specified for all discrete and fixed-point /* Likewise, RM_Size must be specified for all discrete and fixed-point
types. */ types. */
if (IN (kind, Discrete_Or_Fixed_Point_Kind) gcc_assert (!IN (kind, Discrete_Or_Fixed_Point_Kind)
&& Unknown_RM_Size (gnat_entity)) || !Unknown_RM_Size (gnat_entity));
abort ();
/* Get the name of the entity and set up the line number and filename of /* Get the name of the entity and set up the line number and filename of
the original definition for use in any decl we make. */ the original definition for use in any decl we make. */
...@@ -284,16 +279,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -284,16 +279,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* If we get here, it means we have not yet done anything with this /* If we get here, it means we have not yet done anything with this
entity. If we are not defining it here, it must be external, entity. If we are not defining it here, it must be external,
otherwise we should have defined it already. */ otherwise we should have defined it already. */
if (!definition && ! Is_Public (gnat_entity) gcc_assert (definition || Is_Public (gnat_entity) || type_annotate_only
&& !type_annotate_only || kind == E_Discriminant || kind == E_Component
&& kind != E_Discriminant && kind != E_Component || kind == E_Label
&& kind != E_Label || (kind == E_Constant && Present (Full_View (gnat_entity)))
&& !(kind == E_Constant && Present (Full_View (gnat_entity))) || IN (kind, Type_Kind));
#if 1
&& !IN (kind, Type_Kind)
#endif
)
abort ();
/* For cases when we are not defining (i.e., we are referencing from /* For cases when we are not defining (i.e., we are referencing from
another compilation unit) Public entities, show we are at global level another compilation unit) Public entities, show we are at global level
...@@ -417,10 +407,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -417,10 +407,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{ {
/* A tagged record has no explicit stored discriminants. */ /* A tagged record has no explicit stored discriminants. */
if (First_Discriminant (gnat_record) gcc_assert (First_Discriminant (gnat_record)
!= First_Stored_Discriminant (gnat_record)) == First_Stored_Discriminant (gnat_record));
abort ();
gnu_decl gnu_decl
= gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity), = gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity),
gnu_expr, definition); gnu_expr, definition);
...@@ -438,7 +426,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -438,7 +426,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
else if (Present (Corresponding_Discriminant (gnat_entity)) else if (Present (Corresponding_Discriminant (gnat_entity))
&& (First_Discriminant (gnat_record) && (First_Discriminant (gnat_record)
!= First_Stored_Discriminant (gnat_record))) != First_Stored_Discriminant (gnat_record)))
abort (); gcc_unreachable ();
/* Otherwise, if we are not defining this and we have no GCC type /* Otherwise, if we are not defining this and we have no GCC type
for the containing record, make one for it. Then we should for the containing record, make one for it. Then we should
...@@ -475,7 +463,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -475,7 +463,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Here we have no GCC type and this is a reference rather than a /* Here we have no GCC type and this is a reference rather than a
definition. This should never happen. Most likely the cause is a definition. This should never happen. Most likely the cause is a
reference before declaration in the gnat tree for gnat_entity. */ reference before declaration in the gnat tree for gnat_entity. */
abort (); gcc_unreachable ();
} }
case E_Loop_Parameter: case E_Loop_Parameter:
...@@ -527,10 +515,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -527,10 +515,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| TYPE_IS_DUMMY_P (gnu_type) || TYPE_IS_DUMMY_P (gnu_type)
|| TREE_CODE (gnu_type) == VOID_TYPE) || TREE_CODE (gnu_type) == VOID_TYPE)
{ {
if (type_annotate_only) gcc_assert (type_annotate_only);
return error_mark_node; return error_mark_node;
else }
abort ();
/* If an alignment is specified, use it if valid. Note that
exceptions are objects but don't have alignments. We must do this
before we validate the size, since the alignment can affect the
size. */
if (kind != E_Exception && Known_Alignment (gnat_entity))
{
gcc_assert (Present (Alignment (gnat_entity)));
align = validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (gnu_type));
gnu_type = maybe_pad_type (gnu_type, NULL_TREE, align,
gnat_entity, "PAD", 0, definition, 1);
} }
/* If we are defining the object, see if it has a Size value and /* If we are defining the object, see if it has a Size value and
...@@ -599,17 +598,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -599,17 +598,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Present (Address_Clause (gnat_entity))) && !Present (Address_Clause (gnat_entity)))
gnu_size = bitsize_unit_node; gnu_size = bitsize_unit_node;
/* If an alignment is specified, use it if valid. Note that
exceptions are objects but don't have alignments. */
if (kind != E_Exception && Known_Alignment (gnat_entity))
{
if (No (Alignment (gnat_entity)))
abort ();
align = validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (gnu_type));
}
/* If this is an atomic object with no specified size and alignment, /* If this is an atomic object with no specified size and alignment,
but where the size of the type is a constant, set the alignment to but where the size of the type is a constant, set the alignment to
the lowest power of two greater than the size, or to the the lowest power of two greater than the size, or to the
...@@ -1358,6 +1346,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1358,6 +1346,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_field_type); TYPE_ALIGN (gnu_type) = TYPE_ALIGN (gnu_field_type);
TYPE_PACKED (gnu_type) = 1; TYPE_PACKED (gnu_type) = 1;
/* Create a stripped-down declaration of the original type, mainly
for debugging. */
create_type_decl (get_entity_name (gnat_entity), gnu_field_type,
NULL, true, debug_info_p, gnat_entity);
/* Don't notify the field as "addressable", since we won't be taking /* Don't notify the field as "addressable", since we won't be taking
it's address and it would prevent create_field_decl from making a it's address and it would prevent create_field_decl from making a
bitfield. */ bitfield. */
...@@ -1667,9 +1660,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -1667,9 +1660,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (No (Packed_Array_Type (gnat_entity)) if (No (Packed_Array_Type (gnat_entity))
&& Known_Alignment (gnat_entity)) && Known_Alignment (gnat_entity))
{ {
if (No (Alignment (gnat_entity))) gcc_assert (Present (Alignment (gnat_entity)));
abort ();
TYPE_ALIGN (tem) TYPE_ALIGN (tem)
= validate_alignment (Alignment (gnat_entity), gnat_entity, = validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (tem)); TYPE_ALIGN (tem));
...@@ -2173,8 +2164,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2173,8 +2164,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
} }
/* Abort if packed array with no packed array type field set. */ /* Abort if packed array with no packed array type field set. */
else if (Is_Packed (gnat_entity)) else
abort (); gcc_assert (!Is_Packed (gnat_entity));
break; break;
...@@ -2291,8 +2282,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -2291,8 +2282,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| Present (Record_Extension_Part (record_definition))) || Present (Record_Extension_Part (record_definition)))
record_definition = Record_Extension_Part (record_definition); record_definition = Record_Extension_Part (record_definition);
if (!type_annotate_only && No (Parent_Subtype (gnat_entity))) gcc_assert (type_annotate_only
abort (); || Present (Parent_Subtype (gnat_entity)));
} }
/* Make a node for the record. If we are not defining the record, /* Make a node for the record. If we are not defining the record,
...@@ -3568,9 +3559,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -3568,9 +3559,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
{ {
if (!has_copy_in_out) if (!has_copy_in_out)
{ {
if (TREE_CODE (gnu_return_type) != VOID_TYPE) gcc_assert (TREE_CODE (gnu_return_type) == VOID_TYPE);
abort ();
gnu_return_type = make_node (RECORD_TYPE); gnu_return_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_return_type) = get_identifier ("RETURN"); TYPE_NAME (gnu_return_type) = get_identifier ("RETURN");
has_copy_in_out = true; has_copy_in_out = true;
...@@ -3788,7 +3777,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) ...@@ -3788,7 +3777,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
/* If we had a case where we evaluated another type and it might have /* If we had a case where we evaluated another type and it might have
...@@ -4980,7 +4969,7 @@ choices_to_gnu (tree operand, Node_Id choices) ...@@ -4980,7 +4969,7 @@ choices_to_gnu (tree operand, Node_Id choices)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
result = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, result = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
...@@ -5147,7 +5136,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, ...@@ -5147,7 +5136,7 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
First_Bit (Component_Clause (gnat_field)), gnat_field, First_Bit (Component_Clause (gnat_field)), gnat_field,
TYPE_ALIGN (gnu_field_type)); TYPE_ALIGN (gnu_field_type));
else else
abort (); gcc_unreachable ();
gnu_pos = NULL_TREE; gnu_pos = NULL_TREE;
} }
...@@ -5199,9 +5188,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed, ...@@ -5199,9 +5188,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
"PAD", false, definition, true); "PAD", false, definition, true);
} }
if (TREE_CODE (gnu_field_type) == RECORD_TYPE gcc_assert (TREE_CODE (gnu_field_type) != RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (gnu_field_type)) || !TYPE_CONTAINS_TEMPLATE_P (gnu_field_type));
abort ();
/* Now create the decl for the field. */ /* Now create the decl for the field. */
gnu_field = create_field_decl (gnu_field_id, gnu_field_type, gnu_record_type, gnu_field = create_field_decl (gnu_field_id, gnu_field_type, gnu_record_type,
...@@ -6271,7 +6259,7 @@ gnat_substitute_in_type (tree t, tree f, tree r) ...@@ -6271,7 +6259,7 @@ gnat_substitute_in_type (tree t, tree f, tree r)
case FUNCTION_TYPE: case FUNCTION_TYPE:
case LANG_TYPE: case LANG_TYPE:
/* Don't know how to do these yet. */ /* Don't know how to do these yet. */
abort (); gcc_unreachable ();
case ARRAY_TYPE: case ARRAY_TYPE:
{ {
...@@ -6411,9 +6399,7 @@ gnat_substitute_in_type (tree t, tree f, tree r) ...@@ -6411,9 +6399,7 @@ gnat_substitute_in_type (tree t, tree f, tree r)
else if (!changed_field) else if (!changed_field)
return t; return t;
if (field_has_rep) gcc_assert (!field_has_rep);
abort ();
layout_type (new); layout_type (new);
/* If the size was originally a constant use it. */ /* If the size was originally a constant use it. */
......
...@@ -238,9 +238,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name, ...@@ -238,9 +238,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
if (Exception_Mechanism == GCC_ZCX) if (Exception_Mechanism == GCC_ZCX)
gnat_init_gcc_eh (); gnat_init_gcc_eh ();
if (Nkind (gnat_root) != N_Compilation_Unit) gcc_assert (Nkind (gnat_root) == N_Compilation_Unit);
abort ();
Compilation_Unit_to_gnu (gnat_root); Compilation_Unit_to_gnu (gnat_root);
/* Now see if we have any elaboration procedures to deal with. */ /* Now see if we have any elaboration procedures to deal with. */
...@@ -289,8 +287,7 @@ gnat_init_stmt_group () ...@@ -289,8 +287,7 @@ gnat_init_stmt_group ()
if (!Stack_Check_Probes_On_Target) if (!Stack_Check_Probes_On_Target)
set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check")); set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check"));
if (Exception_Mechanism == Front_End_ZCX) gcc_assert (Exception_Mechanism != Front_End_ZCX);
abort ();
REAL_ARITHMETIC (dconstp5, RDIV_EXPR, dconst1, dconst2); REAL_ARITHMETIC (dconstp5, RDIV_EXPR, dconst1, dconst2);
REAL_ARITHMETIC (dconstmp5, RDIV_EXPR, dconstm1, dconst2); REAL_ARITHMETIC (dconstmp5, RDIV_EXPR, dconstm1, dconst2);
...@@ -320,23 +317,23 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p) ...@@ -320,23 +317,23 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
? gnat_node : Entity (gnat_node)); ? gnat_node : Entity (gnat_node));
gnat_temp_type = Etype (gnat_temp); gnat_temp_type = Etype (gnat_temp);
if (Etype (gnat_node) != gnat_temp_type gcc_assert (Etype (gnat_node) == gnat_temp_type
&& !(Is_Packed (gnat_temp_type) || (Is_Packed (gnat_temp_type)
&& Etype (gnat_node) == Packed_Array_Type (gnat_temp_type)) && Etype (gnat_node) == Packed_Array_Type (gnat_temp_type))
&& !(Is_Class_Wide_Type (Etype (gnat_node))) || (Is_Class_Wide_Type (Etype (gnat_node)))
&& !(IN (Ekind (gnat_temp_type), Private_Kind) || (IN (Ekind (gnat_temp_type), Private_Kind)
&& Present (Full_View (gnat_temp_type)) && Present (Full_View (gnat_temp_type))
&& ((Etype (gnat_node) == Full_View (gnat_temp_type)) && ((Etype (gnat_node) == Full_View (gnat_temp_type))
|| (Is_Packed (Full_View (gnat_temp_type)) || (Is_Packed (Full_View (gnat_temp_type))
&& (Etype (gnat_node) && (Etype (gnat_node)
== Packed_Array_Type (Full_View (gnat_temp_type)))))) == Packed_Array_Type (Full_View
&& (!Is_Itype (Etype (gnat_node)) || !Is_Itype (gnat_temp_type)) (gnat_temp_type))))))
&& (Ekind (gnat_temp) == E_Variable || (Is_Itype (Etype (gnat_node)) && Is_Itype (gnat_temp_type))
|| Ekind (gnat_temp) == E_Component || !(Ekind (gnat_temp) == E_Variable
|| Ekind (gnat_temp) == E_Constant || Ekind (gnat_temp) == E_Component
|| Ekind (gnat_temp) == E_Loop_Parameter || Ekind (gnat_temp) == E_Constant
|| IN (Ekind (gnat_temp), Formal_Kind))) || Ekind (gnat_temp) == E_Loop_Parameter
abort (); || IN (Ekind (gnat_temp), Formal_Kind)));
/* If this is a reference to a deferred constant whose partial view is an /* If this is a reference to a deferred constant whose partial view is an
unconstrained private type, the proper type is on the full view of the unconstrained private type, the proper type is on the full view of the
...@@ -533,8 +530,7 @@ Pragma_to_gnu (Node_Id gnat_node) ...@@ -533,8 +530,7 @@ Pragma_to_gnu (Node_Id gnat_node)
break; break;
default: default:
abort (); gcc_unreachable ();
break;
} }
break; break;
...@@ -748,8 +744,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -748,8 +744,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
else else
gnu_result = rm_size (gnu_type); gnu_result = rm_size (gnu_type);
if (!gnu_result) gcc_assert (gnu_result);
abort ();
/* Deal with a self-referential size by returning the maximum size for a /* Deal with a self-referential size by returning the maximum size for a
type and by qualifying the size with the object for 'Size of an type and by qualifying the size with the object for 'Size of an
...@@ -863,9 +858,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -863,9 +858,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
for (; Dimension > 1; Dimension--) for (; Dimension > 1; Dimension--)
gnu_type = TREE_TYPE (gnu_type); gnu_type = TREE_TYPE (gnu_type);
if (TREE_CODE (gnu_type) != ARRAY_TYPE) gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
abort ();
if (attribute == Attr_First) if (attribute == Attr_First)
gnu_result gnu_result
= TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type))); = TYPE_MIN_VALUE (TYPE_INDEX_TYPE (TYPE_DOMAIN (gnu_type)));
...@@ -933,10 +926,10 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -933,10 +926,10 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
break; break;
} }
else if (TREE_CODE (gnu_prefix) != COMPONENT_REF else
&& !(attribute == Attr_Bit_Position gcc_assert (TREE_CODE (gnu_prefix) == COMPONENT_REF
&& TREE_CODE (gnu_prefix) == FIELD_DECL)) || (attribute == Attr_Bit_Position
abort (); && TREE_CODE (gnu_prefix) == FIELD_DECL));
get_inner_reference (gnu_prefix, &bitsize, &bitpos, &gnu_offset, get_inner_reference (gnu_prefix, &bitsize, &bitpos, &gnu_offset,
&mode, &unsignedp, &volatilep); &mode, &unsignedp, &volatilep);
...@@ -1036,8 +1029,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute) ...@@ -1036,8 +1029,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
&& TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type))) && TYPE_MULTI_ARRAY_P (TREE_TYPE (gnu_type)))
gnu_type = TREE_TYPE (gnu_type); gnu_type = TREE_TYPE (gnu_type);
if (TREE_CODE (gnu_type) != ARRAY_TYPE) gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
abort ();
/* Note this size cannot be self-referential. */ /* Note this size cannot be self-referential. */
gnu_result = TYPE_SIZE (TREE_TYPE (gnu_type)); gnu_result = TYPE_SIZE (TREE_TYPE (gnu_type));
...@@ -1194,7 +1186,7 @@ Case_Statement_to_gnu (Node_Id gnat_node) ...@@ -1194,7 +1186,7 @@ Case_Statement_to_gnu (Node_Id gnat_node)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node, add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node,
...@@ -1555,8 +1547,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target) ...@@ -1555,8 +1547,7 @@ call_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, tree gnu_target)
Eliminate_Error_Msg (gnat_node, Entity (Name (gnat_node))); Eliminate_Error_Msg (gnat_node, Entity (Name (gnat_node)));
} }
if (TREE_CODE (gnu_subprog_type) != FUNCTION_TYPE) gcc_assert (TREE_CODE (gnu_subprog_type) == FUNCTION_TYPE);
abort ();
/* If we are calling a stubbed function, make this into a raise of /* If we are calling a stubbed function, make this into a raise of
Program_Error. Elaborate all our args first. */ Program_Error. Elaborate all our args first. */
...@@ -2268,7 +2259,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node) ...@@ -2268,7 +2259,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
} }
} }
else else
abort (); gcc_unreachable ();
gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node, gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
gnu_choice, this_choice); gnu_choice, this_choice);
...@@ -2329,7 +2320,7 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node) ...@@ -2329,7 +2320,7 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node)
by the personality routine. */ by the personality routine. */
} }
else else
abort (); gcc_unreachable ();
/* The GCC interface expects NULL to be passed for catch all handlers, so /* The GCC interface expects NULL to be passed for catch all handlers, so
it would be quite tempting to set gnu_etypes_list to NULL if gnu_etype it would be quite tempting to set gnu_etypes_list to NULL if gnu_etype
...@@ -2534,8 +2525,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -2534,8 +2525,7 @@ gnat_to_gnu (Node_Id gnat_node)
of the subtype, but that causes problems with subtypes whose usage of the subtype, but that causes problems with subtypes whose usage
will raise Constraint_Error and with biased representation, so will raise Constraint_Error and with biased representation, so
we don't. */ we don't. */
if (TREE_CONSTANT_OVERFLOW (gnu_result)) gcc_assert (!TREE_CONSTANT_OVERFLOW (gnu_result));
abort ();
} }
break; break;
...@@ -2563,14 +2553,13 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -2563,14 +2553,13 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = UI_To_gnu (Corresponding_Integer_Value (gnat_node), gnu_result = UI_To_gnu (Corresponding_Integer_Value (gnat_node),
gnu_result_type); gnu_result_type);
if (TREE_CONSTANT_OVERFLOW (gnu_result)) gcc_assert (!TREE_CONSTANT_OVERFLOW (gnu_result));
abort ();
} }
/* We should never see a Vax_Float type literal, since the front end /* We should never see a Vax_Float type literal, since the front end
is supposed to transform these using appropriate conversions */ is supposed to transform these using appropriate conversions */
else if (Vax_Float (Underlying_Type (Etype (gnat_node)))) else if (Vax_Float (Underlying_Type (Etype (gnat_node))))
abort (); gcc_unreachable ();
else else
{ {
...@@ -2604,13 +2593,11 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -2604,13 +2593,11 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result, gnu_result,
UI_To_gnu (Denominator (ur_realval), UI_To_gnu (Denominator (ur_realval),
gnu_result_type)); gnu_result_type));
else if (Rbase (ur_realval) != 2)
abort ();
else else
{ {
REAL_VALUE_TYPE tmp; REAL_VALUE_TYPE tmp;
gcc_assert (Rbase (ur_realval) == 2);
real_ldexp (&tmp, &TREE_REAL_CST (gnu_result), real_ldexp (&tmp, &TREE_REAL_CST (gnu_result),
- UI_To_Int (Denominator (ur_realval))); - UI_To_Int (Denominator (ur_realval)));
gnu_result = build_real (gnu_result_type, tmp); gnu_result = build_real (gnu_result_type, tmp);
...@@ -2836,9 +2823,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -2836,9 +2823,7 @@ gnat_to_gnu (Node_Id gnat_node)
for (i = 0, gnu_type = TREE_TYPE (gnu_array_object); for (i = 0, gnu_type = TREE_TYPE (gnu_array_object);
i < ndim; i++, gnu_type = TREE_TYPE (gnu_type)) i < ndim; i++, gnu_type = TREE_TYPE (gnu_type))
{ {
if (TREE_CODE (gnu_type) != ARRAY_TYPE) gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
abort ();
gnat_temp = gnat_expr_array[i]; gnat_temp = gnat_expr_array[i];
gnu_expr = gnat_to_gnu (gnat_temp); gnu_expr = gnat_to_gnu (gnat_temp);
...@@ -2979,9 +2964,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -2979,9 +2964,7 @@ gnat_to_gnu (Node_Id gnat_node)
== N_Attribute_Reference)); == N_Attribute_Reference));
} }
if (!gnu_result) gcc_assert (gnu_result);
abort ();
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
} }
break; break;
...@@ -3064,7 +3047,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -3064,7 +3047,7 @@ gnat_to_gnu (Node_Id gnat_node)
(Next (Next
(First (Component_Associations (gnat_node)))))); (First (Component_Associations (gnat_node))))));
else else
abort (); gcc_unreachable ();
gnu_result = convert (gnu_result_type, gnu_result); gnu_result = convert (gnu_result_type, gnu_result);
} }
...@@ -3138,7 +3121,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -3138,7 +3121,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_high = TYPE_MAX_VALUE (gnu_range_type); gnu_high = TYPE_MAX_VALUE (gnu_range_type);
} }
else else
abort (); gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
...@@ -3379,7 +3362,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -3379,7 +3362,7 @@ gnat_to_gnu (Node_Id gnat_node)
} }
} }
else else
abort (); gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node)); gnu_result_type = get_unpadded_type (Etype (gnat_node));
return build_allocator (gnu_type, gnu_init, gnu_result_type, return build_allocator (gnu_type, gnu_init, gnu_result_type,
...@@ -3758,12 +3741,11 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -3758,12 +3741,11 @@ gnat_to_gnu (Node_Id gnat_node)
/* If there is an At_End procedure attached to this node, and the EH /* If there is an At_End procedure attached to this node, and the EH
mechanism is SJLJ, we must have at least a corresponding At_End mechanism is SJLJ, we must have at least a corresponding At_End
handler, unless the No_Exception_Handlers restriction is set. */ handler, unless the No_Exception_Handlers restriction is set. */
if (!type_annotate_only gcc_assert (type_annotate_only
&& Exception_Mechanism == Setjmp_Longjmp || Exception_Mechanism != Setjmp_Longjmp
&& Present (At_End_Proc (gnat_node)) || No (At_End_Proc (gnat_node))
&& !Present (Exception_Handlers (gnat_node)) || Present (Exception_Handlers (gnat_node))
&& !No_Exception_Handlers_Set()) || No_Exception_Handlers_Set ());
abort ();
gnu_result = Handled_Sequence_Of_Statements_to_gnu (gnat_node); gnu_result = Handled_Sequence_Of_Statements_to_gnu (gnat_node);
break; break;
...@@ -3774,7 +3756,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -3774,7 +3756,7 @@ gnat_to_gnu (Node_Id gnat_node)
else if (Exception_Mechanism == GCC_ZCX) else if (Exception_Mechanism == GCC_ZCX)
gnu_result = Exception_Handler_to_gnu_zcx (gnat_node); gnu_result = Exception_Handler_to_gnu_zcx (gnat_node);
else else
abort (); gcc_unreachable ();
break; break;
...@@ -4015,9 +3997,7 @@ gnat_to_gnu (Node_Id gnat_node) ...@@ -4015,9 +3997,7 @@ gnat_to_gnu (Node_Id gnat_node)
case N_Component_Association: case N_Component_Association:
case N_Task_Body: case N_Task_Body:
default: default:
if (!type_annotate_only) gcc_assert (type_annotate_only);
abort ();
gnu_result = alloc_stmt_list (); gnu_result = alloc_stmt_list ();
} }
...@@ -4331,9 +4311,7 @@ add_cleanup (tree gnu_cleanup) ...@@ -4331,9 +4311,7 @@ add_cleanup (tree gnu_cleanup)
void void
set_block_for_group (tree gnu_block) set_block_for_group (tree gnu_block)
{ {
if (current_stmt_group->block) gcc_assert (!current_stmt_group->block);
abort ();
current_stmt_group->block = gnu_block; current_stmt_group->block = gnu_block;
} }
...@@ -4458,7 +4436,7 @@ gnat_expand_stmt (tree gnu_stmt) ...@@ -4458,7 +4436,7 @@ gnat_expand_stmt (tree gnu_stmt)
#endif #endif
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -4511,10 +4489,7 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED) ...@@ -4511,10 +4489,7 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
TREE_READONLY (new_var) = 1; TREE_READONLY (new_var) = 1;
TREE_STATIC (new_var) = 1; TREE_STATIC (new_var) = 1;
TREE_ADDRESSABLE (new_var) = 1; TREE_ADDRESSABLE (new_var) = 1;
DECL_INITIAL (new_var) = TREE_OPERAND (expr, 0);
gimplify_and_add (build2 (MODIFY_EXPR, TREE_TYPE (new_var),
new_var, TREE_OPERAND (expr, 0)),
pre_p);
TREE_OPERAND (expr, 0) = new_var; TREE_OPERAND (expr, 0) = new_var;
return GS_ALL_DONE; return GS_ALL_DONE;
...@@ -4615,7 +4590,7 @@ gnat_gimplify_stmt (tree *stmt_p) ...@@ -4615,7 +4590,7 @@ gnat_gimplify_stmt (tree *stmt_p)
return GS_OK; return GS_OK;
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -4760,14 +4735,11 @@ process_freeze_entity (Node_Id gnat_node) ...@@ -4760,14 +4735,11 @@ process_freeze_entity (Node_Id gnat_node)
&& !(TREE_CODE (gnu_old) == TYPE_DECL && !(TREE_CODE (gnu_old) == TYPE_DECL
&& TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old)))) && TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old))))
{ {
if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind) gcc_assert ((IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind)
&& Present (Full_View (gnat_entity)) && Present (Full_View (gnat_entity))
&& No (Freeze_Node (Full_View (gnat_entity)))) && No (Freeze_Node (Full_View (gnat_entity))))
return; || Is_Concurrent_Type (gnat_entity));
else if (Is_Concurrent_Type (gnat_entity)) return;
return;
else
abort ();
} }
/* Reset the saved tree, if any, and elaborate the object or type for real. /* Reset the saved tree, if any, and elaborate the object or type for real.
...@@ -5352,10 +5324,8 @@ process_type (Entity_Id gnat_entity) ...@@ -5352,10 +5324,8 @@ process_type (Entity_Id gnat_entity)
/* If this was a withed access type, this is not an error /* If this was a withed access type, this is not an error
and merely indicates we've already elaborated the type and merely indicates we've already elaborated the type
already. */ already. */
if (Is_Type (gnat_entity) && From_With_Type (gnat_entity)) gcc_assert (Is_Type (gnat_entity) && From_With_Type (gnat_entity));
return; return;
abort ();
} }
save_gnu_tree (gnat_entity, NULL_TREE, false); save_gnu_tree (gnat_entity, NULL_TREE, false);
...@@ -5363,8 +5333,7 @@ process_type (Entity_Id gnat_entity) ...@@ -5363,8 +5333,7 @@ process_type (Entity_Id gnat_entity)
/* Now fully elaborate the type. */ /* Now fully elaborate the type. */
gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1); gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1);
if (TREE_CODE (gnu_new) != TYPE_DECL) gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL);
abort ();
/* If we have an old type and we've made pointers to this type, /* If we have an old type and we've made pointers to this type,
update those pointers. */ update those pointers. */
...@@ -5402,7 +5371,7 @@ process_type (Entity_Id gnat_entity) ...@@ -5402,7 +5371,7 @@ process_type (Entity_Id gnat_entity)
static tree static tree
assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type) assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type)
{ {
tree gnu_field, gnu_list, gnu_result; tree gnu_list, gnu_result;
/* We test for GNU_FIELD being empty in the case where a variant /* We test for GNU_FIELD being empty in the case where a variant
was the last thing since we don't take things off GNAT_ASSOC in was the last thing since we don't take things off GNAT_ASSOC in
...@@ -5418,8 +5387,7 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type) ...@@ -5418,8 +5387,7 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type)
/* The expander is supposed to put a single component selector name /* The expander is supposed to put a single component selector name
in every record component association */ in every record component association */
if (Next (gnat_field)) gcc_assert (No (Next (gnat_field)));
abort ();
/* Before assigning a value in an aggregate make sure range checks /* Before assigning a value in an aggregate make sure range checks
are done if required. Then convert to the type of the field. */ are done if required. Then convert to the type of the field. */
...@@ -5434,10 +5402,15 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type) ...@@ -5434,10 +5402,15 @@ assoc_to_constructor (Node_Id gnat_assoc, tree gnu_type)
gnu_result = extract_values (gnu_list, gnu_type); gnu_result = extract_values (gnu_list, gnu_type);
/* Verify every enty in GNU_LIST was used. */ #ifdef ENABLE_CHECKING
for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field)) {
if (!TREE_ADDRESSABLE (gnu_field)) tree gnu_field;
abort ();
/* Verify every enty in GNU_LIST was used. */
for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field))
gcc_assert (TREE_ADDRESSABLE (gnu_field));
}
#endif
return gnu_result; return gnu_result;
} }
...@@ -5754,7 +5727,7 @@ gnat_stabilize_reference_1 (tree e, bool force) ...@@ -5754,7 +5727,7 @@ gnat_stabilize_reference_1 (tree e, bool force)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
TREE_READONLY (result) = TREE_READONLY (e); TREE_READONLY (result) = TREE_READONLY (e);
......
...@@ -154,11 +154,9 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) ...@@ -154,11 +154,9 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check)
to something which is a decl. Raise gigi 401 if not. Usually, this to something which is a decl. Raise gigi 401 if not. Usually, this
means GNAT_ENTITY is defined twice, but occasionally is due to some means GNAT_ENTITY is defined twice, but occasionally is due to some
Gigi problem. */ Gigi problem. */
if (gnu_decl gcc_assert (!gnu_decl
&& (associate_gnat_to_gnu[gnat_entity - First_Node_Id] || (!associate_gnat_to_gnu[gnat_entity - First_Node_Id]
|| (!no_check && !DECL_P (gnu_decl)))) && (no_check || DECL_P (gnu_decl))));
abort ();
associate_gnat_to_gnu[gnat_entity - First_Node_Id] = gnu_decl; associate_gnat_to_gnu[gnat_entity - First_Node_Id] = gnu_decl;
} }
...@@ -172,9 +170,7 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check) ...@@ -172,9 +170,7 @@ save_gnu_tree (Entity_Id gnat_entity, tree gnu_decl, bool no_check)
tree tree
get_gnu_tree (Entity_Id gnat_entity) get_gnu_tree (Entity_Id gnat_entity)
{ {
if (!associate_gnat_to_gnu[gnat_entity - First_Node_Id]) gcc_assert (associate_gnat_to_gnu[gnat_entity - First_Node_Id]);
abort ();
return associate_gnat_to_gnu[gnat_entity - First_Node_Id]; return associate_gnat_to_gnu[gnat_entity - First_Node_Id];
} }
...@@ -729,7 +725,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -729,7 +725,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
enum tree_code code = TREE_CODE (record_type); enum tree_code code = TREE_CODE (record_type);
tree ada_size = bitsize_zero_node; tree ada_size = bitsize_zero_node;
tree size = bitsize_zero_node; tree size = bitsize_zero_node;
tree size_unit = size_zero_node;
bool var_size = false; bool var_size = false;
tree field; tree field;
...@@ -785,7 +780,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -785,7 +780,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
tree type = TREE_TYPE (field); tree type = TREE_TYPE (field);
tree this_size = DECL_SIZE (field); tree this_size = DECL_SIZE (field);
tree this_size_unit = DECL_SIZE_UNIT (field);
tree this_ada_size = DECL_SIZE (field); tree this_ada_size = DECL_SIZE (field);
/* We need to make an XVE/XVU record if any field has variable size, /* We need to make an XVE/XVU record if any field has variable size,
...@@ -826,7 +820,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -826,7 +820,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
case UNION_TYPE: case UNION_TYPE:
ada_size = size_binop (MAX_EXPR, ada_size, this_ada_size); ada_size = size_binop (MAX_EXPR, ada_size, this_ada_size);
size = size_binop (MAX_EXPR, size, this_size); size = size_binop (MAX_EXPR, size, this_size);
size_unit = size_binop (MAX_EXPR, size_unit, this_size_unit);
break; break;
case QUAL_UNION_TYPE: case QUAL_UNION_TYPE:
...@@ -835,9 +828,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -835,9 +828,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
this_ada_size, ada_size)); this_ada_size, ada_size));
size = fold (build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field), size = fold (build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_size, size)); this_size, size));
size_unit = fold (build3 (COND_EXPR, sizetype,
DECL_QUALIFIER (field),
this_size_unit, size_unit));
break; break;
case RECORD_TYPE: case RECORD_TYPE:
...@@ -854,13 +844,10 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -854,13 +844,10 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
TREE_CODE (type) == QUAL_UNION_TYPE, has_rep); TREE_CODE (type) == QUAL_UNION_TYPE, has_rep);
size = merge_sizes (size, pos, this_size, size = merge_sizes (size, pos, this_size,
TREE_CODE (type) == QUAL_UNION_TYPE, has_rep); TREE_CODE (type) == QUAL_UNION_TYPE, has_rep);
size_unit
= merge_sizes (size_unit, byte_position (field), this_size_unit,
TREE_CODE (type) == QUAL_UNION_TYPE, has_rep);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -871,10 +858,7 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -871,10 +858,7 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
what was specified in it, if any. */ what was specified in it, if any. */
if (TREE_CODE (record_type) == RECORD_TYPE if (TREE_CODE (record_type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type)) && TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type))
{ size = TYPE_SIZE (record_type);
size = TYPE_SIZE (record_type);
size_unit = TYPE_SIZE_UNIT (record_type);
}
/* Now set any of the values we've just computed that apply. */ /* Now set any of the values we've just computed that apply. */
if (!TYPE_IS_FAT_POINTER_P (record_type) if (!TYPE_IS_FAT_POINTER_P (record_type)
...@@ -887,6 +871,9 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep, ...@@ -887,6 +871,9 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
&& TYPE_IS_PADDING_P (record_type) && TYPE_IS_PADDING_P (record_type)
&& CONTAINS_PLACEHOLDER_P (size))) && CONTAINS_PLACEHOLDER_P (size)))
{ {
tree size_unit
= convert (sizetype, size_binop (CEIL_DIV_EXPR, size,
bitsize_unit_node));
TYPE_SIZE (record_type) = round_up (size, TYPE_ALIGN (record_type)); TYPE_SIZE (record_type) = round_up (size, TYPE_ALIGN (record_type));
TYPE_SIZE_UNIT (record_type) TYPE_SIZE_UNIT (record_type)
= round_up (size_unit, = round_up (size_unit,
...@@ -1894,9 +1881,7 @@ float_type_for_precision (int precision, enum machine_mode mode) ...@@ -1894,9 +1881,7 @@ float_type_for_precision (int precision, enum machine_mode mode)
TYPE_PRECISION (t) = precision; TYPE_PRECISION (t) = precision;
layout_type (t); layout_type (t);
if (TYPE_MODE (t) != mode) gcc_assert (TYPE_MODE (t) == mode);
abort ();
if (!TYPE_NAME (t)) if (!TYPE_NAME (t))
{ {
sprintf (type_name, "FLOAT_%d", precision); sprintf (type_name, "FLOAT_%d", precision);
...@@ -2076,7 +2061,7 @@ max_size (tree exp, bool max_p) ...@@ -2076,7 +2061,7 @@ max_size (tree exp, bool max_p)
break; break;
} }
abort (); gcc_unreachable ();
} }
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE. /* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
...@@ -2125,7 +2110,7 @@ build_template (tree template_type, tree array_type, tree expr) ...@@ -2125,7 +2110,7 @@ build_template (tree template_type, tree array_type, tree expr)
&& DECL_BY_COMPONENT_PTR_P (expr)) && DECL_BY_COMPONENT_PTR_P (expr))
bounds = TREE_TYPE (field); bounds = TREE_TYPE (field);
else else
abort (); gcc_unreachable ();
min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds)); min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds));
max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds)); max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds));
...@@ -2564,7 +2549,7 @@ update_pointer_to (tree old_type, tree new_type) ...@@ -2564,7 +2549,7 @@ update_pointer_to (tree old_type, tree new_type)
pointers to void. In that case, copy the field list from the pointers to void. In that case, copy the field list from the
old type to the new one and update the fields' context. */ old type to the new one and update the fields' context. */
else if (TREE_CODE (ptr) != RECORD_TYPE || !TYPE_IS_FAT_POINTER_P (ptr)) else if (TREE_CODE (ptr) != RECORD_TYPE || !TYPE_IS_FAT_POINTER_P (ptr))
abort (); gcc_unreachable ();
else else
{ {
...@@ -3009,7 +2994,7 @@ convert (tree type, tree expr) ...@@ -3009,7 +2994,7 @@ convert (tree type, tree expr)
convert (TREE_TYPE (tem), expr)); convert (TREE_TYPE (tem), expr));
} }
abort (); gcc_unreachable ();
case UNCONSTRAINED_ARRAY_TYPE: case UNCONSTRAINED_ARRAY_TYPE:
/* If EXPR is a constrained array, take its address, convert it to a /* If EXPR is a constrained array, take its address, convert it to a
...@@ -3037,13 +3022,13 @@ convert (tree type, tree expr) ...@@ -3037,13 +3022,13 @@ convert (tree type, tree expr)
build_unary_op (ADDR_EXPR, build_unary_op (ADDR_EXPR,
NULL_TREE, expr))); NULL_TREE, expr)));
else else
abort (); gcc_unreachable ();
case COMPLEX_TYPE: case COMPLEX_TYPE:
return fold (convert_to_complex (type, expr)); return fold (convert_to_complex (type, expr));
default: default:
abort (); gcc_unreachable ();
} }
} }
......
...@@ -734,9 +734,8 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -734,9 +734,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
break; break;
} }
if (TREE_CODE (result) != INDIRECT_REF && TREE_CODE (result) != NULL_EXPR gcc_assert (TREE_CODE (result) == INDIRECT_REF
&& !DECL_P (result)) || TREE_CODE (result) == NULL_EXPR || DECL_P (result));
abort ();
/* Convert the right operand to the operation type unless /* Convert the right operand to the operation type unless
it is either already of the correct type or if the type it is either already of the correct type or if the type
...@@ -783,8 +782,7 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -783,8 +782,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
case LE_EXPR: case LE_EXPR:
case GT_EXPR: case GT_EXPR:
case LT_EXPR: case LT_EXPR:
if (POINTER_TYPE_P (left_type)) gcc_assert (!POINTER_TYPE_P (left_type));
abort ();
/* ... fall through ... */ /* ... fall through ... */
...@@ -833,12 +831,10 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -833,12 +831,10 @@ build_binary_op (enum tree_code op_code, tree result_type,
{ {
result = compare_arrays (result_type, left_operand, right_operand); result = compare_arrays (result_type, left_operand, right_operand);
if (op_code == EQ_EXPR) if (op_code == NE_EXPR)
;
else if (op_code == NE_EXPR)
result = invert_truthvalue (result); result = invert_truthvalue (result);
else else
abort (); gcc_assert (op_code == EQ_EXPR);
return result; return result;
} }
...@@ -857,9 +853,9 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -857,9 +853,9 @@ build_binary_op (enum tree_code op_code, tree result_type,
Even better is if one is of fixed size. */ Even better is if one is of fixed size. */
best_type = NULL_TREE; best_type = NULL_TREE;
if (!TYPE_NAME (left_base_type) gcc_assert (TYPE_NAME (left_base_type)
|| TYPE_NAME (left_base_type) != TYPE_NAME (right_base_type)) && (TYPE_NAME (left_base_type)
abort (); == TYPE_NAME (right_base_type)));
if (TREE_CONSTANT (TYPE_SIZE (left_base_type))) if (TREE_CONSTANT (TYPE_SIZE (left_base_type)))
best_type = left_base_type; best_type = left_base_type;
...@@ -870,13 +866,13 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -870,13 +866,13 @@ build_binary_op (enum tree_code op_code, tree result_type,
else if (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (right_base_type))) else if (!CONTAINS_PLACEHOLDER_P (TYPE_SIZE (right_base_type)))
best_type = right_base_type; best_type = right_base_type;
else else
abort (); gcc_unreachable ();
left_operand = convert (best_type, left_operand); left_operand = convert (best_type, left_operand);
right_operand = convert (best_type, right_operand); right_operand = convert (best_type, right_operand);
} }
else else
abort (); gcc_unreachable ();
} }
/* If we are comparing a fat pointer against zero, we need to /* If we are comparing a fat pointer against zero, we need to
...@@ -913,9 +909,7 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -913,9 +909,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
we guarantee that no overflow can occur. So nothing special need we guarantee that no overflow can occur. So nothing special need
be done for modular types. */ be done for modular types. */
if (left_type != result_type) gcc_assert (left_type == result_type);
abort ();
operation_type = get_base_type (result_type); operation_type = get_base_type (result_type);
left_operand = convert (operation_type, left_operand); left_operand = convert (operation_type, left_operand);
right_operand = convert (operation_type, right_operand); right_operand = convert (operation_type, right_operand);
...@@ -930,9 +924,7 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -930,9 +924,7 @@ build_binary_op (enum tree_code op_code, tree result_type,
/* The RHS of a shift can be any type. Also, ignore any modulus /* The RHS of a shift can be any type. Also, ignore any modulus
(we used to abort, but this is needed for unchecked conversion (we used to abort, but this is needed for unchecked conversion
to modular types). Otherwise, processing is the same as normal. */ to modular types). Otherwise, processing is the same as normal. */
if (operation_type != left_base_type) gcc_assert (operation_type == left_base_type);
abort ();
modulus = NULL_TREE; modulus = NULL_TREE;
left_operand = convert (operation_type, left_operand); left_operand = convert (operation_type, left_operand);
break; break;
...@@ -957,10 +949,8 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -957,10 +949,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
goto common; goto common;
case COMPLEX_EXPR: case COMPLEX_EXPR:
if (TREE_TYPE (result_type) != left_base_type gcc_assert (TREE_TYPE (result_type) == left_base_type
|| TREE_TYPE (result_type) != right_base_type) && TREE_TYPE (result_type) == right_base_type);
abort ();
left_operand = convert (left_base_type, left_operand); left_operand = convert (left_base_type, left_operand);
right_operand = convert (right_base_type, right_operand); right_operand = convert (right_base_type, right_operand);
break; break;
...@@ -979,10 +969,8 @@ build_binary_op (enum tree_code op_code, tree result_type, ...@@ -979,10 +969,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
both operands (and they should be the same). Convert both operands (and they should be the same). Convert
everything to the result type. */ everything to the result type. */
if (operation_type != left_base_type gcc_assert (operation_type == left_base_type
|| left_base_type != right_base_type) && left_base_type == right_base_type);
abort ();
left_operand = convert (operation_type, left_operand); left_operand = convert (operation_type, left_operand);
right_operand = convert (operation_type, right_operand); right_operand = convert (operation_type, right_operand);
} }
...@@ -1053,16 +1041,14 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) ...@@ -1053,16 +1041,14 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
case IMAGPART_EXPR: case IMAGPART_EXPR:
if (!operation_type) if (!operation_type)
result_type = operation_type = TREE_TYPE (type); result_type = operation_type = TREE_TYPE (type);
else if (result_type != TREE_TYPE (type)) else
abort (); gcc_assert (result_type == TREE_TYPE (type));
result = fold (build1 (op_code, operation_type, operand)); result = fold (build1 (op_code, operation_type, operand));
break; break;
case TRUTH_NOT_EXPR: case TRUTH_NOT_EXPR:
if (result_type != base_type) gcc_assert (result_type == base_type);
abort ();
result = invert_truthvalue (gnat_truthvalue_conversion (operand)); result = invert_truthvalue (gnat_truthvalue_conversion (operand));
break; break;
...@@ -1252,9 +1238,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) ...@@ -1252,9 +1238,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
if (modulus) if (modulus)
{ {
if (operation_type != base_type) gcc_assert (operation_type == base_type);
abort ();
operand = convert (operation_type, operand); operand = convert (operation_type, operand);
/* The fastest in the negate case for binary modulus is /* The fastest in the negate case for binary modulus is
...@@ -1317,9 +1301,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand) ...@@ -1317,9 +1301,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
/* ... fall through ... */ /* ... fall through ... */
default: default:
if (operation_type != base_type) gcc_assert (operation_type == base_type);
abort ();
result = fold (build1 (op_code, operation_type, convert (operation_type, result = fold (build1 (op_code, operation_type, convert (operation_type,
operand))); operand)));
} }
...@@ -1534,12 +1516,11 @@ build_simple_component_ref (tree record_variable, tree component, ...@@ -1534,12 +1516,11 @@ build_simple_component_ref (tree record_variable, tree component,
tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable)); tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable));
tree ref; tree ref;
if ((TREE_CODE (record_type) != RECORD_TYPE gcc_assert ((TREE_CODE (record_type) == RECORD_TYPE
&& TREE_CODE (record_type) != UNION_TYPE || TREE_CODE (record_type) == UNION_TYPE
&& TREE_CODE (record_type) != QUAL_UNION_TYPE) || TREE_CODE (record_type) == QUAL_UNION_TYPE)
|| !TYPE_SIZE (record_type) && TYPE_SIZE (record_type)
|| (component != 0) == (field != 0)) && (component != 0) != (field != 0));
abort ();
/* If no field was specified, look for a field with the specified name /* If no field was specified, look for a field with the specified name
in the current record only. */ in the current record only. */
...@@ -1626,12 +1607,9 @@ build_component_ref (tree record_variable, tree component, ...@@ -1626,12 +1607,9 @@ build_component_ref (tree record_variable, tree component,
/* If FIELD was specified, assume this is an invalid user field so /* If FIELD was specified, assume this is an invalid user field so
raise constraint error. Otherwise, we can't find the type to return, so raise constraint error. Otherwise, we can't find the type to return, so
abort. */ abort. */
gcc_assert (field);
else if (field) return build1 (NULL_EXPR, TREE_TYPE (field),
return build1 (NULL_EXPR, TREE_TYPE (field), build_call_raise (CE_Discriminant_Check_Failed));
build_call_raise (CE_Discriminant_Check_Failed));
else
abort ();
} }
/* Build a GCC tree to call an allocation or deallocation function. /* Build a GCC tree to call an allocation or deallocation function.
...@@ -1750,7 +1728,7 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align, ...@@ -1750,7 +1728,7 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl)); build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
} }
else else
abort (); gcc_unreachable ();
#if 0 #if 0
return build2 (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align); return build2 (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align);
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment