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. */
......
...@@ -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