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
This commit is contained in:
Richard Kenner 2004-10-04 14:56:04 +00:00 committed by Arnaud Charlet
parent 6a294a2917
commit 8005f3e521
6 changed files with 189 additions and 251 deletions

View File

@ -1,3 +1,21 @@
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>
* a-dirval-mingw.adb (Invalid_Character): Add '\' as invalid character

View File

@ -89,9 +89,7 @@ UI_To_gnu (Uint Input, tree type)
? type : integer_type_node);
tree gnu_base = build_cst_from_int (comp_type, Base);
if (Length <= 0)
abort ();
gcc_assert (Length > 0);
gnu_ret = build_cst_from_int (comp_type, First);
if (First < 0)
for (Idx++, Length--; Length; Idx++, Length--)

View File

@ -117,9 +117,7 @@ gnat_to_gnu_type (Entity_Id gnat_entity)
/* Convert the ada entity type into a GCC TYPE_DECL node. */
gnu_decl = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 0);
if (TREE_CODE (gnu_decl) != TYPE_DECL)
abort ();
gcc_assert (TREE_CODE (gnu_decl) == TYPE_DECL);
return TREE_TYPE (gnu_decl);
}
@ -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,
i.e. that its scope does not correspond to the subprogram in which
it is declared */
abort ();
gcc_unreachable ();
}
/* If this is entity 0, something went badly wrong. */
if (No (gnat_entity))
abort ();
gcc_assert (Present (gnat_entity));
/* 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.
@ -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
Esize must be specified unless it was specified by the programmer. */
if ((IN (kind, Numeric_Kind) || IN (kind, Enumeration_Kind)
|| (IN (kind, Access_Kind)
&& kind != E_Access_Protected_Subprogram_Type
&& kind != E_Access_Subtype))
&& Unknown_Esize (gnat_entity)
&& !Has_Size_Clause (gnat_entity))
abort ();
gcc_assert (!Unknown_Esize (gnat_entity)
|| Has_Size_Clause (gnat_entity)
|| (!IN (kind, Numeric_Kind) && !IN (kind, Enumeration_Kind)
&& (!IN (kind, Access_Kind)
|| kind == E_Access_Protected_Subprogram_Type
|| kind == E_Access_Subtype)));
/* Likewise, RM_Size must be specified for all discrete and fixed-point
types. */
if (IN (kind, Discrete_Or_Fixed_Point_Kind)
&& Unknown_RM_Size (gnat_entity))
abort ();
gcc_assert (!IN (kind, Discrete_Or_Fixed_Point_Kind)
|| !Unknown_RM_Size (gnat_entity));
/* 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. */
@ -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
entity. If we are not defining it here, it must be external,
otherwise we should have defined it already. */
if (!definition && ! Is_Public (gnat_entity)
&& !type_annotate_only
&& kind != E_Discriminant && kind != E_Component
&& kind != E_Label
&& !(kind == E_Constant && Present (Full_View (gnat_entity)))
#if 1
&& !IN (kind, Type_Kind)
#endif
)
abort ();
gcc_assert (definition || Is_Public (gnat_entity) || type_annotate_only
|| kind == E_Discriminant || kind == E_Component
|| kind == E_Label
|| (kind == E_Constant && Present (Full_View (gnat_entity)))
|| IN (kind, Type_Kind));
/* For cases when we are not defining (i.e., we are referencing from
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)
{
/* A tagged record has no explicit stored discriminants. */
if (First_Discriminant (gnat_record)
!= First_Stored_Discriminant (gnat_record))
abort ();
gcc_assert (First_Discriminant (gnat_record)
== First_Stored_Discriminant (gnat_record));
gnu_decl
= gnat_to_gnu_entity (Corresponding_Discriminant (gnat_entity),
gnu_expr, 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))
&& (First_Discriminant (gnat_record)
!= First_Stored_Discriminant (gnat_record)))
abort ();
gcc_unreachable ();
/* Otherwise, if we are not defining this and we have no GCC type
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)
/* 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
reference before declaration in the gnat tree for gnat_entity. */
abort ();
gcc_unreachable ();
}
case E_Loop_Parameter:
@ -527,10 +515,21 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| TYPE_IS_DUMMY_P (gnu_type)
|| TREE_CODE (gnu_type) == VOID_TYPE)
{
if (type_annotate_only)
return error_mark_node;
else
abort ();
gcc_assert (type_annotate_only);
return error_mark_node;
}
/* 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
@ -599,17 +598,6 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
&& !Present (Address_Clause (gnat_entity)))
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,
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
@ -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_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
it's address and it would prevent create_field_decl from making a
bitfield. */
@ -1667,9 +1660,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
if (No (Packed_Array_Type (gnat_entity))
&& Known_Alignment (gnat_entity))
{
if (No (Alignment (gnat_entity)))
abort ();
gcc_assert (Present (Alignment (gnat_entity)));
TYPE_ALIGN (tem)
= validate_alignment (Alignment (gnat_entity), gnat_entity,
TYPE_ALIGN (tem));
@ -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. */
else if (Is_Packed (gnat_entity))
abort ();
else
gcc_assert (!Is_Packed (gnat_entity));
break;
@ -2291,8 +2282,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
|| Present (Record_Extension_Part (record_definition)))
record_definition = Record_Extension_Part (record_definition);
if (!type_annotate_only && No (Parent_Subtype (gnat_entity)))
abort ();
gcc_assert (type_annotate_only
|| Present (Parent_Subtype (gnat_entity)));
}
/* 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)
{
if (!has_copy_in_out)
{
if (TREE_CODE (gnu_return_type) != VOID_TYPE)
abort ();
gcc_assert (TREE_CODE (gnu_return_type) == VOID_TYPE);
gnu_return_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_return_type) = get_identifier ("RETURN");
has_copy_in_out = true;
@ -3788,7 +3777,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
break;
default:
abort ();
gcc_unreachable ();
}
/* 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)
break;
default:
abort ();
gcc_unreachable ();
}
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,
First_Bit (Component_Clause (gnat_field)), gnat_field,
TYPE_ALIGN (gnu_field_type));
else
abort ();
gcc_unreachable ();
gnu_pos = NULL_TREE;
}
@ -5199,9 +5188,8 @@ gnat_to_gnu_field (Entity_Id gnat_field, tree gnu_record_type, int packed,
"PAD", false, definition, true);
}
if (TREE_CODE (gnu_field_type) == RECORD_TYPE
&& TYPE_CONTAINS_TEMPLATE_P (gnu_field_type))
abort ();
gcc_assert (TREE_CODE (gnu_field_type) != RECORD_TYPE
|| !TYPE_CONTAINS_TEMPLATE_P (gnu_field_type));
/* Now create the decl for the field. */
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)
case FUNCTION_TYPE:
case LANG_TYPE:
/* Don't know how to do these yet. */
abort ();
gcc_unreachable ();
case ARRAY_TYPE:
{
@ -6411,9 +6399,7 @@ gnat_substitute_in_type (tree t, tree f, tree r)
else if (!changed_field)
return t;
if (field_has_rep)
abort ();
gcc_assert (!field_has_rep);
layout_type (new);
/* If the size was originally a constant use it. */

View File

@ -238,9 +238,7 @@ gigi (Node_Id gnat_root, int max_gnat_node, int number_name,
if (Exception_Mechanism == GCC_ZCX)
gnat_init_gcc_eh ();
if (Nkind (gnat_root) != N_Compilation_Unit)
abort ();
gcc_assert (Nkind (gnat_root) == N_Compilation_Unit);
Compilation_Unit_to_gnu (gnat_root);
/* Now see if we have any elaboration procedures to deal with. */
@ -289,8 +287,7 @@ gnat_init_stmt_group ()
if (!Stack_Check_Probes_On_Target)
set_stack_check_libfunc (gen_rtx_SYMBOL_REF (Pmode, "_gnat_stack_check"));
if (Exception_Mechanism == Front_End_ZCX)
abort ();
gcc_assert (Exception_Mechanism != Front_End_ZCX);
REAL_ARITHMETIC (dconstp5, RDIV_EXPR, dconst1, dconst2);
REAL_ARITHMETIC (dconstmp5, RDIV_EXPR, dconstm1, dconst2);
@ -320,23 +317,23 @@ Identifier_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p)
? gnat_node : Entity (gnat_node));
gnat_temp_type = Etype (gnat_temp);
if (Etype (gnat_node) != gnat_temp_type
&& !(Is_Packed (gnat_temp_type)
&& Etype (gnat_node) == Packed_Array_Type (gnat_temp_type))
&& !(Is_Class_Wide_Type (Etype (gnat_node)))
&& !(IN (Ekind (gnat_temp_type), Private_Kind)
&& Present (Full_View (gnat_temp_type))
&& ((Etype (gnat_node) == Full_View (gnat_temp_type))
|| (Is_Packed (Full_View (gnat_temp_type))
&& (Etype (gnat_node)
== Packed_Array_Type (Full_View (gnat_temp_type))))))
&& (!Is_Itype (Etype (gnat_node)) || !Is_Itype (gnat_temp_type))
&& (Ekind (gnat_temp) == E_Variable
|| Ekind (gnat_temp) == E_Component
|| Ekind (gnat_temp) == E_Constant
|| Ekind (gnat_temp) == E_Loop_Parameter
|| IN (Ekind (gnat_temp), Formal_Kind)))
abort ();
gcc_assert (Etype (gnat_node) == gnat_temp_type
|| (Is_Packed (gnat_temp_type)
&& Etype (gnat_node) == Packed_Array_Type (gnat_temp_type))
|| (Is_Class_Wide_Type (Etype (gnat_node)))
|| (IN (Ekind (gnat_temp_type), Private_Kind)
&& Present (Full_View (gnat_temp_type))
&& ((Etype (gnat_node) == Full_View (gnat_temp_type))
|| (Is_Packed (Full_View (gnat_temp_type))
&& (Etype (gnat_node)
== Packed_Array_Type (Full_View
(gnat_temp_type))))))
|| (Is_Itype (Etype (gnat_node)) && Is_Itype (gnat_temp_type))
|| !(Ekind (gnat_temp) == E_Variable
|| Ekind (gnat_temp) == E_Component
|| Ekind (gnat_temp) == E_Constant
|| Ekind (gnat_temp) == E_Loop_Parameter
|| IN (Ekind (gnat_temp), Formal_Kind)));
/* 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
@ -533,8 +530,7 @@ Pragma_to_gnu (Node_Id gnat_node)
break;
default:
abort ();
break;
gcc_unreachable ();
}
break;
@ -748,8 +744,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
else
gnu_result = rm_size (gnu_type);
if (!gnu_result)
abort ();
gcc_assert (gnu_result);
/* 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
@ -863,9 +858,7 @@ Attribute_to_gnu (Node_Id gnat_node, tree *gnu_result_type_p, int attribute)
for (; Dimension > 1; Dimension--)
gnu_type = TREE_TYPE (gnu_type);
if (TREE_CODE (gnu_type) != ARRAY_TYPE)
abort ();
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
if (attribute == Attr_First)
gnu_result
= 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)
break;
}
else if (TREE_CODE (gnu_prefix) != COMPONENT_REF
&& !(attribute == Attr_Bit_Position
&& TREE_CODE (gnu_prefix) == FIELD_DECL))
abort ();
else
gcc_assert (TREE_CODE (gnu_prefix) == COMPONENT_REF
|| (attribute == Attr_Bit_Position
&& TREE_CODE (gnu_prefix) == FIELD_DECL));
get_inner_reference (gnu_prefix, &bitsize, &bitpos, &gnu_offset,
&mode, &unsignedp, &volatilep);
@ -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)))
gnu_type = TREE_TYPE (gnu_type);
if (TREE_CODE (gnu_type) != ARRAY_TYPE)
abort ();
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
/* Note this size cannot be self-referential. */
gnu_result = TYPE_SIZE (TREE_TYPE (gnu_type));
@ -1194,7 +1186,7 @@ Case_Statement_to_gnu (Node_Id gnat_node)
break;
default:
abort ();
gcc_unreachable ();
}
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)
Eliminate_Error_Msg (gnat_node, Entity (Name (gnat_node)));
}
if (TREE_CODE (gnu_subprog_type) != FUNCTION_TYPE)
abort ();
gcc_assert (TREE_CODE (gnu_subprog_type) == FUNCTION_TYPE);
/* If we are calling a stubbed function, make this into a raise of
Program_Error. Elaborate all our args first. */
@ -2268,7 +2259,7 @@ Exception_Handler_to_gnu_sjlj (Node_Id gnat_node)
}
}
else
abort ();
gcc_unreachable ();
gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
gnu_choice, this_choice);
@ -2329,7 +2320,7 @@ Exception_Handler_to_gnu_zcx (Node_Id gnat_node)
by the personality routine. */
}
else
abort ();
gcc_unreachable ();
/* 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
@ -2534,8 +2525,7 @@ gnat_to_gnu (Node_Id gnat_node)
of the subtype, but that causes problems with subtypes whose usage
will raise Constraint_Error and with biased representation, so
we don't. */
if (TREE_CONSTANT_OVERFLOW (gnu_result))
abort ();
gcc_assert (!TREE_CONSTANT_OVERFLOW (gnu_result));
}
break;
@ -2563,14 +2553,13 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result_type = get_unpadded_type (Etype (gnat_node));
gnu_result = UI_To_gnu (Corresponding_Integer_Value (gnat_node),
gnu_result_type);
if (TREE_CONSTANT_OVERFLOW (gnu_result))
abort ();
gcc_assert (!TREE_CONSTANT_OVERFLOW (gnu_result));
}
/* We should never see a Vax_Float type literal, since the front end
is supposed to transform these using appropriate conversions */
else if (Vax_Float (Underlying_Type (Etype (gnat_node))))
abort ();
gcc_unreachable ();
else
{
@ -2604,13 +2593,11 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_result,
UI_To_gnu (Denominator (ur_realval),
gnu_result_type));
else if (Rbase (ur_realval) != 2)
abort ();
else
{
REAL_VALUE_TYPE tmp;
gcc_assert (Rbase (ur_realval) == 2);
real_ldexp (&tmp, &TREE_REAL_CST (gnu_result),
- UI_To_Int (Denominator (ur_realval)));
gnu_result = build_real (gnu_result_type, tmp);
@ -2836,9 +2823,7 @@ gnat_to_gnu (Node_Id gnat_node)
for (i = 0, gnu_type = TREE_TYPE (gnu_array_object);
i < ndim; i++, gnu_type = TREE_TYPE (gnu_type))
{
if (TREE_CODE (gnu_type) != ARRAY_TYPE)
abort ();
gcc_assert (TREE_CODE (gnu_type) == ARRAY_TYPE);
gnat_temp = gnat_expr_array[i];
gnu_expr = gnat_to_gnu (gnat_temp);
@ -2979,9 +2964,7 @@ gnat_to_gnu (Node_Id gnat_node)
== N_Attribute_Reference));
}
if (!gnu_result)
abort ();
gcc_assert (gnu_result);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
}
break;
@ -3064,7 +3047,7 @@ gnat_to_gnu (Node_Id gnat_node)
(Next
(First (Component_Associations (gnat_node))))));
else
abort ();
gcc_unreachable ();
gnu_result = convert (gnu_result_type, gnu_result);
}
@ -3138,7 +3121,7 @@ gnat_to_gnu (Node_Id gnat_node)
gnu_high = TYPE_MAX_VALUE (gnu_range_type);
}
else
abort ();
gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node));
@ -3379,7 +3362,7 @@ gnat_to_gnu (Node_Id gnat_node)
}
}
else
abort ();
gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (gnat_node));
return build_allocator (gnu_type, gnu_init, gnu_result_type,
@ -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
mechanism is SJLJ, we must have at least a corresponding At_End
handler, unless the No_Exception_Handlers restriction is set. */
if (!type_annotate_only
&& Exception_Mechanism == Setjmp_Longjmp
&& Present (At_End_Proc (gnat_node))
&& !Present (Exception_Handlers (gnat_node))
&& !No_Exception_Handlers_Set())
abort ();
gcc_assert (type_annotate_only
|| Exception_Mechanism != Setjmp_Longjmp
|| No (At_End_Proc (gnat_node))
|| Present (Exception_Handlers (gnat_node))
|| No_Exception_Handlers_Set ());
gnu_result = Handled_Sequence_Of_Statements_to_gnu (gnat_node);
break;
@ -3774,7 +3756,7 @@ gnat_to_gnu (Node_Id gnat_node)
else if (Exception_Mechanism == GCC_ZCX)
gnu_result = Exception_Handler_to_gnu_zcx (gnat_node);
else
abort ();
gcc_unreachable ();
break;
@ -4015,9 +3997,7 @@ gnat_to_gnu (Node_Id gnat_node)
case N_Component_Association:
case N_Task_Body:
default:
if (!type_annotate_only)
abort ();
gcc_assert (type_annotate_only);
gnu_result = alloc_stmt_list ();
}
@ -4331,9 +4311,7 @@ add_cleanup (tree gnu_cleanup)
void
set_block_for_group (tree gnu_block)
{
if (current_stmt_group->block)
abort ();
gcc_assert (!current_stmt_group->block);
current_stmt_group->block = gnu_block;
}
@ -4458,7 +4436,7 @@ gnat_expand_stmt (tree gnu_stmt)
#endif
default:
abort ();
gcc_unreachable ();
}
}
@ -4511,10 +4489,7 @@ gnat_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p ATTRIBUTE_UNUSED)
TREE_READONLY (new_var) = 1;
TREE_STATIC (new_var) = 1;
TREE_ADDRESSABLE (new_var) = 1;
gimplify_and_add (build2 (MODIFY_EXPR, TREE_TYPE (new_var),
new_var, TREE_OPERAND (expr, 0)),
pre_p);
DECL_INITIAL (new_var) = TREE_OPERAND (expr, 0);
TREE_OPERAND (expr, 0) = new_var;
return GS_ALL_DONE;
@ -4615,7 +4590,7 @@ gnat_gimplify_stmt (tree *stmt_p)
return GS_OK;
default:
abort ();
gcc_unreachable ();
}
}
@ -4760,14 +4735,11 @@ process_freeze_entity (Node_Id gnat_node)
&& !(TREE_CODE (gnu_old) == TYPE_DECL
&& TYPE_IS_DUMMY_P (TREE_TYPE (gnu_old))))
{
if (IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind)
&& Present (Full_View (gnat_entity))
&& No (Freeze_Node (Full_View (gnat_entity))))
return;
else if (Is_Concurrent_Type (gnat_entity))
return;
else
abort ();
gcc_assert ((IN (Ekind (gnat_entity), Incomplete_Or_Private_Kind)
&& Present (Full_View (gnat_entity))
&& No (Freeze_Node (Full_View (gnat_entity))))
|| Is_Concurrent_Type (gnat_entity));
return;
}
/* Reset the saved tree, if any, and elaborate the object or type for real.
@ -5352,10 +5324,8 @@ process_type (Entity_Id gnat_entity)
/* If this was a withed access type, this is not an error
and merely indicates we've already elaborated the type
already. */
if (Is_Type (gnat_entity) && From_With_Type (gnat_entity))
return;
abort ();
gcc_assert (Is_Type (gnat_entity) && From_With_Type (gnat_entity));
return;
}
save_gnu_tree (gnat_entity, NULL_TREE, false);
@ -5363,8 +5333,7 @@ process_type (Entity_Id gnat_entity)
/* Now fully elaborate the type. */
gnu_new = gnat_to_gnu_entity (gnat_entity, NULL_TREE, 1);
if (TREE_CODE (gnu_new) != TYPE_DECL)
abort ();
gcc_assert (TREE_CODE (gnu_new) == TYPE_DECL);
/* If we have an old type and we've made pointers to this type,
update those pointers. */
@ -5402,7 +5371,7 @@ process_type (Entity_Id gnat_entity)
static tree
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
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)
/* The expander is supposed to put a single component selector name
in every record component association */
if (Next (gnat_field))
abort ();
gcc_assert (No (Next (gnat_field)));
/* Before assigning a value in an aggregate make sure range checks
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)
gnu_result = extract_values (gnu_list, gnu_type);
/* Verify every enty in GNU_LIST was used. */
for (gnu_field = gnu_list; gnu_field; gnu_field = TREE_CHAIN (gnu_field))
if (!TREE_ADDRESSABLE (gnu_field))
abort ();
#ifdef ENABLE_CHECKING
{
tree gnu_field;
/* 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;
}
@ -5754,7 +5727,7 @@ gnat_stabilize_reference_1 (tree e, bool force)
break;
default:
abort ();
gcc_unreachable ();
}
TREE_READONLY (result) = TREE_READONLY (e);

View File

@ -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
means GNAT_ENTITY is defined twice, but occasionally is due to some
Gigi problem. */
if (gnu_decl
&& (associate_gnat_to_gnu[gnat_entity - First_Node_Id]
|| (!no_check && !DECL_P (gnu_decl))))
abort ();
gcc_assert (!gnu_decl
|| (!associate_gnat_to_gnu[gnat_entity - First_Node_Id]
&& (no_check || DECL_P (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)
tree
get_gnu_tree (Entity_Id gnat_entity)
{
if (!associate_gnat_to_gnu[gnat_entity - First_Node_Id])
abort ();
gcc_assert (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,
enum tree_code code = TREE_CODE (record_type);
tree ada_size = bitsize_zero_node;
tree size = bitsize_zero_node;
tree size_unit = size_zero_node;
bool var_size = false;
tree field;
@ -785,7 +780,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
tree type = TREE_TYPE (field);
tree this_size = DECL_SIZE (field);
tree this_size_unit = DECL_SIZE_UNIT (field);
tree this_ada_size = DECL_SIZE (field);
/* 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,
case UNION_TYPE:
ada_size = size_binop (MAX_EXPR, ada_size, this_ada_size);
size = size_binop (MAX_EXPR, size, this_size);
size_unit = size_binop (MAX_EXPR, size_unit, this_size_unit);
break;
case QUAL_UNION_TYPE:
@ -835,9 +828,6 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
this_ada_size, ada_size));
size = fold (build3 (COND_EXPR, bitsizetype, DECL_QUALIFIER (field),
this_size, size));
size_unit = fold (build3 (COND_EXPR, sizetype,
DECL_QUALIFIER (field),
this_size_unit, size_unit));
break;
case RECORD_TYPE:
@ -854,13 +844,10 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
TREE_CODE (type) == QUAL_UNION_TYPE, has_rep);
size = merge_sizes (size, pos, this_size,
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;
default:
abort ();
gcc_unreachable ();
}
}
@ -871,10 +858,7 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
what was specified in it, if any. */
if (TREE_CODE (record_type) == RECORD_TYPE
&& TYPE_IS_PADDING_P (record_type) && TYPE_SIZE (record_type))
{
size = TYPE_SIZE (record_type);
size_unit = TYPE_SIZE_UNIT (record_type);
}
size = TYPE_SIZE (record_type);
/* Now set any of the values we've just computed that apply. */
if (!TYPE_IS_FAT_POINTER_P (record_type)
@ -887,6 +871,9 @@ finish_record_type (tree record_type, tree fieldlist, bool has_rep,
&& TYPE_IS_PADDING_P (record_type)
&& 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_UNIT (record_type)
= round_up (size_unit,
@ -1894,9 +1881,7 @@ float_type_for_precision (int precision, enum machine_mode mode)
TYPE_PRECISION (t) = precision;
layout_type (t);
if (TYPE_MODE (t) != mode)
abort ();
gcc_assert (TYPE_MODE (t) == mode);
if (!TYPE_NAME (t))
{
sprintf (type_name, "FLOAT_%d", precision);
@ -2076,7 +2061,7 @@ max_size (tree exp, bool max_p)
break;
}
abort ();
gcc_unreachable ();
}
/* 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)
&& DECL_BY_COMPONENT_PTR_P (expr))
bounds = TREE_TYPE (field);
else
abort ();
gcc_unreachable ();
min = convert (TREE_TYPE (TREE_CHAIN (field)), TYPE_MIN_VALUE (bounds));
max = convert (TREE_TYPE (field), TYPE_MAX_VALUE (bounds));
@ -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
old type to the new one and update the fields' context. */
else if (TREE_CODE (ptr) != RECORD_TYPE || !TYPE_IS_FAT_POINTER_P (ptr))
abort ();
gcc_unreachable ();
else
{
@ -3009,7 +2994,7 @@ convert (tree type, tree expr)
convert (TREE_TYPE (tem), expr));
}
abort ();
gcc_unreachable ();
case UNCONSTRAINED_ARRAY_TYPE:
/* If EXPR is a constrained array, take its address, convert it to a
@ -3037,13 +3022,13 @@ convert (tree type, tree expr)
build_unary_op (ADDR_EXPR,
NULL_TREE, expr)));
else
abort ();
gcc_unreachable ();
case COMPLEX_TYPE:
return fold (convert_to_complex (type, expr));
default:
abort ();
gcc_unreachable ();
}
}

View File

@ -734,9 +734,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
break;
}
if (TREE_CODE (result) != INDIRECT_REF && TREE_CODE (result) != NULL_EXPR
&& !DECL_P (result))
abort ();
gcc_assert (TREE_CODE (result) == INDIRECT_REF
|| TREE_CODE (result) == NULL_EXPR || DECL_P (result));
/* Convert the right operand to the operation type unless
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,
case LE_EXPR:
case GT_EXPR:
case LT_EXPR:
if (POINTER_TYPE_P (left_type))
abort ();
gcc_assert (!POINTER_TYPE_P (left_type));
/* ... fall through ... */
@ -833,12 +831,10 @@ build_binary_op (enum tree_code op_code, tree result_type,
{
result = compare_arrays (result_type, left_operand, right_operand);
if (op_code == EQ_EXPR)
;
else if (op_code == NE_EXPR)
if (op_code == NE_EXPR)
result = invert_truthvalue (result);
else
abort ();
gcc_assert (op_code == EQ_EXPR);
return result;
}
@ -857,9 +853,9 @@ build_binary_op (enum tree_code op_code, tree result_type,
Even better is if one is of fixed size. */
best_type = NULL_TREE;
if (!TYPE_NAME (left_base_type)
|| TYPE_NAME (left_base_type) != TYPE_NAME (right_base_type))
abort ();
gcc_assert (TYPE_NAME (left_base_type)
&& (TYPE_NAME (left_base_type)
== TYPE_NAME (right_base_type)));
if (TREE_CONSTANT (TYPE_SIZE (left_base_type)))
best_type = left_base_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)))
best_type = right_base_type;
else
abort ();
gcc_unreachable ();
left_operand = convert (best_type, left_operand);
right_operand = convert (best_type, right_operand);
}
else
abort ();
gcc_unreachable ();
}
/* 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,
we guarantee that no overflow can occur. So nothing special need
be done for modular types. */
if (left_type != result_type)
abort ();
gcc_assert (left_type == result_type);
operation_type = get_base_type (result_type);
left_operand = convert (operation_type, left_operand);
right_operand = convert (operation_type, right_operand);
@ -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
(we used to abort, but this is needed for unchecked conversion
to modular types). Otherwise, processing is the same as normal. */
if (operation_type != left_base_type)
abort ();
gcc_assert (operation_type == left_base_type);
modulus = NULL_TREE;
left_operand = convert (operation_type, left_operand);
break;
@ -957,10 +949,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
goto common;
case COMPLEX_EXPR:
if (TREE_TYPE (result_type) != left_base_type
|| TREE_TYPE (result_type) != right_base_type)
abort ();
gcc_assert (TREE_TYPE (result_type) == left_base_type
&& TREE_TYPE (result_type) == right_base_type);
left_operand = convert (left_base_type, left_operand);
right_operand = convert (right_base_type, right_operand);
break;
@ -979,10 +969,8 @@ build_binary_op (enum tree_code op_code, tree result_type,
both operands (and they should be the same). Convert
everything to the result type. */
if (operation_type != left_base_type
|| left_base_type != right_base_type)
abort ();
gcc_assert (operation_type == left_base_type
&& left_base_type == right_base_type);
left_operand = convert (operation_type, left_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)
case IMAGPART_EXPR:
if (!operation_type)
result_type = operation_type = TREE_TYPE (type);
else if (result_type != TREE_TYPE (type))
abort ();
else
gcc_assert (result_type == TREE_TYPE (type));
result = fold (build1 (op_code, operation_type, operand));
break;
case TRUTH_NOT_EXPR:
if (result_type != base_type)
abort ();
gcc_assert (result_type == base_type);
result = invert_truthvalue (gnat_truthvalue_conversion (operand));
break;
@ -1252,9 +1238,7 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
if (modulus)
{
if (operation_type != base_type)
abort ();
gcc_assert (operation_type == base_type);
operand = convert (operation_type, operand);
/* 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)
/* ... fall through ... */
default:
if (operation_type != base_type)
abort ();
gcc_assert (operation_type == base_type);
result = fold (build1 (op_code, operation_type, convert (operation_type,
operand)));
}
@ -1534,12 +1516,11 @@ build_simple_component_ref (tree record_variable, tree component,
tree record_type = TYPE_MAIN_VARIANT (TREE_TYPE (record_variable));
tree ref;
if ((TREE_CODE (record_type) != RECORD_TYPE
&& TREE_CODE (record_type) != UNION_TYPE
&& TREE_CODE (record_type) != QUAL_UNION_TYPE)
|| !TYPE_SIZE (record_type)
|| (component != 0) == (field != 0))
abort ();
gcc_assert ((TREE_CODE (record_type) == RECORD_TYPE
|| TREE_CODE (record_type) == UNION_TYPE
|| TREE_CODE (record_type) == QUAL_UNION_TYPE)
&& TYPE_SIZE (record_type)
&& (component != 0) != (field != 0));
/* If no field was specified, look for a field with the specified name
in the current record only. */
@ -1626,12 +1607,9 @@ build_component_ref (tree record_variable, tree component,
/* 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
abort. */
else if (field)
return build1 (NULL_EXPR, TREE_TYPE (field),
build_call_raise (CE_Discriminant_Check_Failed));
else
abort ();
gcc_assert (field);
return build1 (NULL_EXPR, TREE_TYPE (field),
build_call_raise (CE_Discriminant_Check_Failed));
}
/* 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,
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
}
else
abort ();
gcc_unreachable ();
#if 0
return build2 (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align);
#endif