+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
? 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--)
/* 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);
}
\f
/* 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.
/* 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. */
/* 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
{
/* 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);
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
/* 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:
|| 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
&& !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
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. */
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));
}
/* 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;
|| 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,
{
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;
break;
default:
- abort ();
+ gcc_unreachable ();
}
/* If we had a case where we evaluated another type and it might have
break;
default:
- abort ();
+ gcc_unreachable ();
}
result = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
First_Bit (Component_Clause (gnat_field)), gnat_field,
TYPE_ALIGN (gnu_field_type));
else
- abort ();
+ gcc_unreachable ();
gnu_pos = NULL_TREE;
}
"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,
case FUNCTION_TYPE:
case LANG_TYPE:
/* Don't know how to do these yet. */
- abort ();
+ gcc_unreachable ();
case ARRAY_TYPE:
{
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. */
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. */
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);
? 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
break;
default:
- abort ();
- break;
+ gcc_unreachable ();
}
break;
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
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)));
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);
&& 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));
break;
default:
- abort ();
+ gcc_unreachable ();
}
add_stmt_with_node (build3 (CASE_LABEL_EXPR, void_type_node,
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. */
}
}
else
- abort ();
+ gcc_unreachable ();
gnu_choice = build_binary_op (TRUTH_ORIF_EXPR, integer_type_node,
gnu_choice, this_choice);
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
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;
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
{
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);
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);
== N_Attribute_Reference));
}
- if (!gnu_result)
- abort ();
-
+ gcc_assert (gnu_result);
gnu_result_type = get_unpadded_type (Etype (gnat_node));
}
break;
(Next
(First (Component_Associations (gnat_node))))));
else
- abort ();
+ gcc_unreachable ();
gnu_result = convert (gnu_result_type, gnu_result);
}
gnu_high = TYPE_MAX_VALUE (gnu_range_type);
}
else
- abort ();
+ gcc_unreachable ();
gnu_result_type = get_unpadded_type (Etype (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,
/* 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;
else if (Exception_Mechanism == GCC_ZCX)
gnu_result = Exception_Handler_to_gnu_zcx (gnat_node);
else
- abort ();
+ gcc_unreachable ();
break;
case N_Component_Association:
case N_Task_Body:
default:
- if (!type_annotate_only)
- abort ();
-
+ gcc_assert (type_annotate_only);
gnu_result = alloc_stmt_list ();
}
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;
}
#endif
default:
- abort ();
+ gcc_unreachable ();
}
}
\f
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;
return GS_OK;
default:
- abort ();
+ gcc_unreachable ();
}
}
\f
&& !(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.
/* 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);
/* 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. */
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
/* 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. */
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;
}
break;
default:
- abort ();
+ gcc_unreachable ();
}
TREE_READONLY (result) = TREE_READONLY (e);
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;
}
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];
}
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;
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,
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:
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:
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 ();
}
}
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)
&& 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,
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);
break;
}
- abort ();
+ gcc_unreachable ();
}
\f
/* Build a template of type TEMPLATE_TYPE from the array bounds of ARRAY_TYPE.
&& 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));
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
{
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
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 ();
}
}
\f
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
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 ... */
{
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;
}
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;
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
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);
/* 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;
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;
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);
}
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;
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
/* ... 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)));
}
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. */
/* 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));
}
\f
/* Build a GCC tree to call an allocation or deallocation function.
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