Commit 366de0ce by Nathan Sidwell Committed by Nathan Sidwell

c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.

	* c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
	* c-common.c (c_type_hash, c_common_nodes_and_builtins,
	c_expand_expr, boolean_increment, nonnull_check_p,
	check_function_arguments_recurse, fold_offsetof_1): Likewise.
	* c-cppbuiltin.c (define__GNUC__, builtin_define_stdint_macros,
	builtin_define_type_max): Likewise.
	* c-decl.c (bind, pop_scope, merge_decls, pushdecl_top_level,
	implicit_decl_warning, builtin_function, build_compound_literal,
	complete_array_type, grokdeclarator, get_parm_info,
	start_function, store_parm_decls_oldstyle,
	c_write_global_declarations): Likewise.
	* c-format.c (get_constant, decode_format_attr,
	maybe_read_dollar_number, get_flag_spec, check_format_arg,
	check_format_types, format_type_warning,
	find_char_info_specifier_index, init_dynamic_asm_fprintf_info,
	init_dynamic_diag_info, handle_format_attribute): Likewise.
	* c-gimplify.c (push_context, pop_context, finish_bc_block):
	* c-lex.c (c_lex_with_flags, lex_string): Likewise.
	* c-objc-common.c (c_tree_printer): Likewise.
	* c-pch.c (pch_init): Likewise.
	* c-pragma.c (maybe_apply_pragma_weak): Likewise.
	* c-pretty-print.c (pp_c_tree_decl_identifier): Likewise.
	* c-typeck.c (c_incomplete_type_error, composite_type,
	common_pointer_type, common_type, same_translation_unit_p,
	tagged_types_tu_compatible_p, finish_init, pop_init_level,
	set_designator, set_nonincremental_init_from_string,
	process_init_element, c_finish_if_stmt): Likewise.
	* caller-save.c (init_caller_save, save_call_clobbered_regs,
	insert_restore, insert_save, insert_one_insn): Likewise.
	* calls.c (emit_call_1, compute_argument_block_size,
	precompute_arguments, expand_call, emit_library_call_value_1,
	store_one_arg): Likewise.

From-SVN: r87140
parent e1bbfc5c
2004-09-07 Nathan Sidwell <nathan@codesourcery.com> 2004-09-07 Nathan Sidwell <nathan@codesourcery.com>
* c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
* c-common.c (c_type_hash, c_common_nodes_and_builtins,
c_expand_expr, boolean_increment, nonnull_check_p,
check_function_arguments_recurse, fold_offsetof_1): Likewise.
* c-cppbuiltin.c (define__GNUC__, builtin_define_stdint_macros,
builtin_define_type_max): Likewise.
* c-decl.c (bind, pop_scope, merge_decls, pushdecl_top_level,
implicit_decl_warning, builtin_function, build_compound_literal,
complete_array_type, grokdeclarator, get_parm_info,
start_function, store_parm_decls_oldstyle,
c_write_global_declarations): Likewise.
* c-format.c (get_constant, decode_format_attr,
maybe_read_dollar_number, get_flag_spec, check_format_arg,
check_format_types, format_type_warning,
find_char_info_specifier_index, init_dynamic_asm_fprintf_info,
init_dynamic_diag_info, handle_format_attribute): Likewise.
* c-gimplify.c (push_context, pop_context, finish_bc_block):
* c-lex.c (c_lex_with_flags, lex_string): Likewise.
* c-objc-common.c (c_tree_printer): Likewise.
* c-pch.c (pch_init): Likewise.
* c-pragma.c (maybe_apply_pragma_weak): Likewise.
* c-pretty-print.c (pp_c_tree_decl_identifier): Likewise.
* c-typeck.c (c_incomplete_type_error, composite_type,
common_pointer_type, common_type, same_translation_unit_p,
tagged_types_tu_compatible_p, finish_init, pop_init_level,
set_designator, set_nonincremental_init_from_string,
process_init_element, c_finish_if_stmt): Likewise.
* caller-save.c (init_caller_save, save_call_clobbered_regs,
insert_restore, insert_save, insert_one_insn): Likewise.
* calls.c (emit_call_1, compute_argument_block_size,
precompute_arguments, expand_call, emit_library_call_value_1,
store_one_arg): Likewise.
2004-09-07 Nathan Sidwell <nathan@codesourcery.com>
* configure.ac (enable-checking): Add release option. Reorganize * configure.ac (enable-checking): Add release option. Reorganize
to avoid repetition. to avoid repetition.
* configure: Rebuilt. * configure: Rebuilt.
......
...@@ -447,7 +447,7 @@ gen_type (const char *ret_val, tree t, formals_style style) ...@@ -447,7 +447,7 @@ gen_type (const char *ret_val, tree t, formals_style style)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
if (TYPE_READONLY (t)) if (TYPE_READONLY (t))
......
...@@ -2578,7 +2578,7 @@ c_type_hash (const void *p) ...@@ -2578,7 +2578,7 @@ c_type_hash (const void *p)
t2 = TYPE_FIELDS (t); t2 = TYPE_FIELDS (t);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
for (; t2; t2 = TREE_CHAIN (t2)) for (; t2; t2 = TREE_CHAIN (t2))
i++; i++;
...@@ -3188,8 +3188,8 @@ c_common_nodes_and_builtins (void) ...@@ -3188,8 +3188,8 @@ c_common_nodes_and_builtins (void)
{ \ { \
tree decl; \ tree decl; \
\ \
if (strncmp (NAME, "__builtin_", strlen ("__builtin_")) != 0) \ gcc_assert (!strncmp (NAME, "__builtin_", \
abort (); \ strlen ("__builtin_"))); \
\ \
if (!BOTH_P) \ if (!BOTH_P) \
decl = lang_hooks.builtin_function (NAME, builtin_types[TYPE], \ decl = lang_hooks.builtin_function (NAME, builtin_types[TYPE], \
...@@ -3830,7 +3830,7 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode, ...@@ -3830,7 +3830,7 @@ c_expand_expr (tree exp, rtx target, enum machine_mode tmode,
} }
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -3878,7 +3878,7 @@ boolean_increment (enum tree_code code, tree arg) ...@@ -3878,7 +3878,7 @@ boolean_increment (enum tree_code code, tree arg)
val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val); val = build2 (COMPOUND_EXPR, TREE_TYPE (arg), arg, val);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
TREE_SIDE_EFFECTS (val) = 1; TREE_SIDE_EFFECTS (val) = 1;
return val; return val;
...@@ -5111,8 +5111,9 @@ nonnull_check_p (tree args, unsigned HOST_WIDE_INT param_num) ...@@ -5111,8 +5111,9 @@ nonnull_check_p (tree args, unsigned HOST_WIDE_INT param_num)
for (; args; args = TREE_CHAIN (args)) for (; args; args = TREE_CHAIN (args))
{ {
if (! get_nonnull_operand (TREE_VALUE (args), &arg_num)) bool found = get_nonnull_operand (TREE_VALUE (args), &arg_num);
abort ();
gcc_assert (found);
if (arg_num == param_num) if (arg_num == param_num)
return true; return true;
...@@ -5356,9 +5357,8 @@ check_function_arguments_recurse (void (*callback) ...@@ -5356,9 +5357,8 @@ check_function_arguments_recurse (void (*callback)
|| TREE_CODE (format_num_expr) == NON_LVALUE_EXPR) || TREE_CODE (format_num_expr) == NON_LVALUE_EXPR)
format_num_expr = TREE_OPERAND (format_num_expr, 0); format_num_expr = TREE_OPERAND (format_num_expr, 0);
if (TREE_CODE (format_num_expr) != INTEGER_CST gcc_assert (TREE_CODE (format_num_expr) == INTEGER_CST
|| TREE_INT_CST_HIGH (format_num_expr) != 0) && !TREE_INT_CST_HIGH (format_num_expr));
abort ();
format_num = TREE_INT_CST_LOW (format_num_expr); format_num = TREE_INT_CST_LOW (format_num_expr);
...@@ -5619,7 +5619,7 @@ fold_offsetof_1 (tree expr) ...@@ -5619,7 +5619,7 @@ fold_offsetof_1 (tree expr)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
return size_binop (code, base, off); return size_binop (code, base, off);
......
...@@ -261,8 +261,7 @@ define__GNUC__ (void) ...@@ -261,8 +261,7 @@ define__GNUC__ (void)
while (*v && ! ISDIGIT (*v)) while (*v && ! ISDIGIT (*v))
v++; v++;
if (!*v || (v > version_string && v[-1] != '-')) gcc_assert (*v && (v <= version_string || v[-1] == '-'));
abort ();
q = v; q = v;
while (ISDIGIT (*v)) while (ISDIGIT (*v))
...@@ -271,8 +270,8 @@ define__GNUC__ (void) ...@@ -271,8 +270,8 @@ define__GNUC__ (void)
if (c_dialect_cxx ()) if (c_dialect_cxx ())
builtin_define_with_value_n ("__GNUG__", q, v - q); builtin_define_with_value_n ("__GNUG__", q, v - q);
if (*v != '.' || !ISDIGIT (v[1])) gcc_assert (*v == '.' || ISDIGIT (v[1]));
abort ();
q = ++v; q = ++v;
while (ISDIGIT (*v)) while (ISDIGIT (*v))
v++; v++;
...@@ -280,8 +279,7 @@ define__GNUC__ (void) ...@@ -280,8 +279,7 @@ define__GNUC__ (void)
if (*v == '.') if (*v == '.')
{ {
if (!ISDIGIT (v[1])) gcc_assert (ISDIGIT (v[1]));
abort ();
q = ++v; q = ++v;
while (ISDIGIT (*v)) while (ISDIGIT (*v))
v++; v++;
...@@ -290,8 +288,7 @@ define__GNUC__ (void) ...@@ -290,8 +288,7 @@ define__GNUC__ (void)
else else
builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1); builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1);
if (*v && *v != ' ' && *v != '-') gcc_assert (!*v || *v == ' ' || *v == '-');
abort ();
} }
/* Define macros used by <stdint.h>. Currently only defines limits /* Define macros used by <stdint.h>. Currently only defines limits
...@@ -307,7 +304,7 @@ builtin_define_stdint_macros (void) ...@@ -307,7 +304,7 @@ builtin_define_stdint_macros (void)
else if (intmax_type_node == integer_type_node) else if (intmax_type_node == integer_type_node)
intmax_long = 0; intmax_long = 0;
else else
abort (); gcc_unreachable ();
builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long); builtin_define_type_max ("__INTMAX_MAX__", intmax_type_node, intmax_long);
} }
...@@ -617,7 +614,7 @@ builtin_define_type_max (const char *macro, tree type, int is_long) ...@@ -617,7 +614,7 @@ builtin_define_type_max (const char *macro, tree type, int is_long)
case 32: idx = 4; break; case 32: idx = 4; break;
case 64: idx = 6; break; case 64: idx = 6; break;
case 128: idx = 8; break; case 128: idx = 8; break;
default: abort (); default: gcc_unreachable ();
} }
value = values[idx + TYPE_UNSIGNED (type)]; value = values[idx + TYPE_UNSIGNED (type)];
......
...@@ -477,7 +477,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible, bool nested) ...@@ -477,7 +477,7 @@ bind (tree name, tree decl, struct c_scope *scope, bool invisible, bool nested)
case ERROR_MARK: here = &I_SYMBOL_BINDING (name); break; case ERROR_MARK: here = &I_SYMBOL_BINDING (name); break;
default: default:
abort (); gcc_unreachable ();
} }
/* Locate the appropriate place in the chain of shadowed decls /* Locate the appropriate place in the chain of shadowed decls
...@@ -731,10 +731,7 @@ pop_scope (void) ...@@ -731,10 +731,7 @@ pop_scope (void)
/* Labels go in BLOCK_VARS. */ /* Labels go in BLOCK_VARS. */
TREE_CHAIN (p) = BLOCK_VARS (block); TREE_CHAIN (p) = BLOCK_VARS (block);
BLOCK_VARS (block) = p; BLOCK_VARS (block) = p;
gcc_assert (I_LABEL_BINDING (b->id) == b);
#ifdef ENABLE_CHECKING
if (I_LABEL_BINDING (b->id) != b) abort ();
#endif
I_LABEL_BINDING (b->id) = b->shadowed; I_LABEL_BINDING (b->id) = b->shadowed;
break; break;
...@@ -747,9 +744,7 @@ pop_scope (void) ...@@ -747,9 +744,7 @@ pop_scope (void)
appears in the bindings list with b->id NULL. */ appears in the bindings list with b->id NULL. */
if (b->id) if (b->id)
{ {
#ifdef ENABLE_CHECKING gcc_assert (I_TAG_BINDING (b->id) == b);
if (I_TAG_BINDING (b->id) != b) abort ();
#endif
I_TAG_BINDING (b->id) = b->shadowed; I_TAG_BINDING (b->id) = b->shadowed;
} }
break; break;
...@@ -819,9 +814,7 @@ pop_scope (void) ...@@ -819,9 +814,7 @@ pop_scope (void)
here with b->id NULL in this case. */ here with b->id NULL in this case. */
if (b->id) if (b->id)
{ {
#ifdef ENABLE_CHECKING gcc_assert (I_SYMBOL_BINDING (b->id) == b);
if (I_SYMBOL_BINDING (b->id) != b) abort ();
#endif
I_SYMBOL_BINDING (b->id) = b->shadowed; I_SYMBOL_BINDING (b->id) = b->shadowed;
if (b->shadowed && b->shadowed->type) if (b->shadowed && b->shadowed->type)
TREE_TYPE (b->shadowed->decl) = b->shadowed->type; TREE_TYPE (b->shadowed->decl) = b->shadowed->type;
...@@ -829,7 +822,7 @@ pop_scope (void) ...@@ -829,7 +822,7 @@ pop_scope (void)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -1527,7 +1520,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype) ...@@ -1527,7 +1520,7 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
for (here = &current_scope->bindings; *here; here = &(*here)->prev) for (here = &current_scope->bindings; *here; here = &(*here)->prev)
if ((*here)->decl == olddecl) if ((*here)->decl == olddecl)
goto found; goto found;
abort (); gcc_unreachable ();
found: found:
b = *here; b = *here;
...@@ -2124,13 +2117,11 @@ pushdecl_top_level (tree x) ...@@ -2124,13 +2117,11 @@ pushdecl_top_level (tree x)
tree name; tree name;
bool nested = false; bool nested = false;
if (TREE_CODE (x) != VAR_DECL) gcc_assert (TREE_CODE (x) == VAR_DECL);
abort ();
name = DECL_NAME (x); name = DECL_NAME (x);
if (I_SYMBOL_BINDING (name)) gcc_assert (!I_SYMBOL_BINDING (name));
abort ();
if (TREE_PUBLIC (x)) if (TREE_PUBLIC (x))
{ {
...@@ -2152,7 +2143,7 @@ implicit_decl_warning (tree id, tree olddecl) ...@@ -2152,7 +2143,7 @@ implicit_decl_warning (tree id, tree olddecl)
case 0: return; case 0: return;
case 1: diag = warning; break; case 1: diag = warning; break;
case 2: diag = error; break; case 2: diag = error; break;
default: abort (); default: gcc_unreachable ();
} }
diag (N_("implicit declaration of function '%E'"), id); diag (N_("implicit declaration of function '%E'"), id);
...@@ -2644,8 +2635,7 @@ builtin_function (const char *name, tree type, int function_code, ...@@ -2644,8 +2635,7 @@ builtin_function (const char *name, tree type, int function_code,
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name)); SET_DECL_ASSEMBLER_NAME (decl, get_identifier (library_name));
/* Should never be called on a symbol with a preexisting meaning. */ /* Should never be called on a symbol with a preexisting meaning. */
if (I_SYMBOL_BINDING (id)) gcc_assert (!I_SYMBOL_BINDING (id));
abort ();
bind (id, decl, external_scope, /*invisible=*/true, /*nested=*/false); bind (id, decl, external_scope, /*invisible=*/true, /*nested=*/false);
...@@ -3439,8 +3429,8 @@ build_compound_literal (tree type, tree init) ...@@ -3439,8 +3429,8 @@ build_compound_literal (tree type, tree init)
if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type)) if (TREE_CODE (type) == ARRAY_TYPE && !COMPLETE_TYPE_P (type))
{ {
int failure = complete_array_type (type, DECL_INITIAL (decl), 1); int failure = complete_array_type (type, DECL_INITIAL (decl), 1);
if (failure)
abort (); gcc_assert (!failure);
} }
type = TREE_TYPE (decl); type = TREE_TYPE (decl);
...@@ -3529,8 +3519,8 @@ complete_array_type (tree type, tree initial_value, int do_default) ...@@ -3529,8 +3519,8 @@ complete_array_type (tree type, tree initial_value, int do_default)
if (maxindex) if (maxindex)
{ {
TYPE_DOMAIN (type) = build_index_type (maxindex); TYPE_DOMAIN (type) = build_index_type (maxindex);
if (!TREE_TYPE (maxindex))
abort (); gcc_assert (TREE_TYPE (maxindex));
} }
/* Lay out the type now that we can get the real answer. */ /* Lay out the type now that we can get the real answer. */
...@@ -3737,7 +3727,7 @@ grokdeclarator (tree declarator, tree declspecs, ...@@ -3737,7 +3727,7 @@ grokdeclarator (tree declarator, tree declspecs,
break; break;
default: default:
abort (); gcc_unreachable ();
} }
orig_name = name; orig_name = name;
if (name == 0) if (name == 0)
...@@ -4211,333 +4201,341 @@ grokdeclarator (tree declarator, tree declspecs, ...@@ -4211,333 +4201,341 @@ grokdeclarator (tree declarator, tree declspecs,
array_parm_static = 0; array_parm_static = 0;
} }
if (TREE_CODE (declarator) == TREE_LIST) switch (TREE_CODE (declarator))
{
/* We encode a declarator with embedded attributes using
a TREE_LIST. */
tree attrs = TREE_PURPOSE (declarator);
tree inner_decl;
int attr_flags = 0;
declarator = TREE_VALUE (declarator);
inner_decl = declarator;
while (inner_decl != NULL_TREE
&& TREE_CODE (inner_decl) == TREE_LIST)
inner_decl = TREE_VALUE (inner_decl);
if (inner_decl == NULL_TREE
|| TREE_CODE (inner_decl) == IDENTIFIER_NODE)
attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
else if (TREE_CODE (inner_decl) == CALL_EXPR)
attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
else if (TREE_CODE (inner_decl) == ARRAY_REF)
attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
returned_attrs = decl_attributes (&type,
chainon (returned_attrs, attrs),
attr_flags);
}
else if (TREE_CODE (declarator) == ARRAY_REF)
{ {
tree itype = NULL_TREE; case TREE_LIST:
tree size = TREE_OPERAND (declarator, 1); {
/* The index is a signed object `sizetype' bits wide. */ /* We encode a declarator with embedded attributes using a
tree index_type = c_common_signed_type (sizetype); TREE_LIST. */
tree attrs = TREE_PURPOSE (declarator);
array_ptr_quals = TREE_TYPE (declarator); tree inner_decl;
array_parm_static = TREE_STATIC (declarator); int attr_flags = 0;
declarator = TREE_VALUE (declarator);
declarator = TREE_OPERAND (declarator, 0); inner_decl = declarator;
while (inner_decl != NULL_TREE
/* Check for some types that there cannot be arrays of. */ && TREE_CODE (inner_decl) == TREE_LIST)
inner_decl = TREE_VALUE (inner_decl);
if (VOID_TYPE_P (type)) if (inner_decl == NULL_TREE
{ || TREE_CODE (inner_decl) == IDENTIFIER_NODE)
error ("declaration of `%s' as array of voids", name); attr_flags |= (int) ATTR_FLAG_DECL_NEXT;
type = error_mark_node; else if (TREE_CODE (inner_decl) == CALL_EXPR)
} attr_flags |= (int) ATTR_FLAG_FUNCTION_NEXT;
else if (TREE_CODE (inner_decl) == ARRAY_REF)
if (TREE_CODE (type) == FUNCTION_TYPE) attr_flags |= (int) ATTR_FLAG_ARRAY_NEXT;
{ returned_attrs = decl_attributes (&type,
error ("declaration of `%s' as array of functions", name); chainon (returned_attrs, attrs),
attr_flags);
break;
}
case ARRAY_REF:
{
tree itype = NULL_TREE;
tree size = TREE_OPERAND (declarator, 1);
/* The index is a signed object `sizetype' bits wide. */
tree index_type = c_common_signed_type (sizetype);
array_ptr_quals = TREE_TYPE (declarator);
array_parm_static = TREE_STATIC (declarator);
declarator = TREE_OPERAND (declarator, 0);
/* Check for some types that there cannot be arrays of. */
if (VOID_TYPE_P (type))
{
error ("declaration of `%s' as array of voids", name);
type = error_mark_node;
}
if (TREE_CODE (type) == FUNCTION_TYPE)
{
error ("declaration of `%s' as array of functions", name);
type = error_mark_node;
}
if (pedantic && !in_system_header && flexible_array_type_p (type))
pedwarn ("invalid use of structure with flexible array member");
if (size == error_mark_node)
type = error_mark_node; type = error_mark_node;
}
if (type == error_mark_node)
if (pedantic && !in_system_header && flexible_array_type_p (type)) continue;
pedwarn ("invalid use of structure with flexible array member");
if (size == error_mark_node)
type = error_mark_node;
if (type == error_mark_node)
continue;
/* If size was specified, set ITYPE to a range-type for that size.
Otherwise, ITYPE remains null. finish_decl may figure it out
from an initial value. */
if (size)
{
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
STRIP_TYPE_NOPS (size);
if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
{
error ("size of array `%s' has non-integer type", name);
size = integer_one_node;
}
if (pedantic && integer_zerop (size))
pedwarn ("ISO C forbids zero-size array `%s'", name);
if (TREE_CODE (size) == INTEGER_CST)
{
constant_expression_warning (size);
if (tree_int_cst_sgn (size) < 0)
{
error ("size of array `%s' is negative", name);
size = integer_one_node;
}
}
else
{
/* Make sure the array size remains visibly nonconstant
even if it is (eg) a const variable with known value. */
size_varies = 1;
if (!flag_isoc99 && pedantic)
{
if (TREE_CONSTANT (size))
pedwarn ("ISO C90 forbids array `%s' whose size can't be evaluated",
name);
else
pedwarn ("ISO C90 forbids variable-size array `%s'",
name);
}
}
if (integer_zerop (size))
{
/* A zero-length array cannot be represented with an
unsigned index type, which is what we'll get with
build_index_type. Create an open-ended range instead. */
itype = build_range_type (sizetype, size, NULL_TREE);
}
else
{
/* Compute the maximum valid index, that is, size - 1.
Do the calculation in index_type, so that if it is
a variable the computations will be done in the
proper mode. */
itype = fold (build2 (MINUS_EXPR, index_type,
convert (index_type, size),
convert (index_type, size_one_node)));
/* If that overflowed, the array is too big.
??? While a size of INT_MAX+1 technically shouldn't
cause an overflow (because we subtract 1), the overflow
is recorded during the conversion to index_type, before
the subtraction. Handling this case seems like an
unnecessary complication. */
if (TREE_OVERFLOW (itype))
{
error ("size of array `%s' is too large", name);
type = error_mark_node;
continue;
}
if (size_varies) /* If size was specified, set ITYPE to a range-type for
itype = variable_size (itype); that size. Otherwise, ITYPE remains null. finish_decl
itype = build_index_type (itype); may figure it out from an initial value. */
}
}
else if (decl_context == FIELD)
{
if (pedantic && !flag_isoc99 && !in_system_header)
pedwarn ("ISO C90 does not support flexible array members");
/* ISO C99 Flexible array members are effectively identical if (size)
to GCC's zero-length array extension. */ {
itype = build_range_type (sizetype, size_zero_node, NULL_TREE); /* Strip NON_LVALUE_EXPRs since we aren't using as an
} lvalue. */
STRIP_TYPE_NOPS (size);
if (! INTEGRAL_TYPE_P (TREE_TYPE (size)))
{
error ("size of array `%s' has non-integer type", name);
size = integer_one_node;
}
if (pedantic && integer_zerop (size))
pedwarn ("ISO C forbids zero-size array `%s'", name);
if (TREE_CODE (size) == INTEGER_CST)
{
constant_expression_warning (size);
if (tree_int_cst_sgn (size) < 0)
{
error ("size of array `%s' is negative", name);
size = integer_one_node;
}
}
else
{
/* Make sure the array size remains visibly
nonconstant even if it is (eg) a const variable
with known value. */
size_varies = 1;
if (!flag_isoc99 && pedantic)
{
if (TREE_CONSTANT (size))
pedwarn ("ISO C90 forbids array `%s' whose size can't be evaluated",
name);
else
pedwarn ("ISO C90 forbids variable-size array `%s'",
name);
}
}
/* If pedantic, complain about arrays of incomplete types. */ if (integer_zerop (size))
{
/* A zero-length array cannot be represented with
an unsigned index type, which is what we'll
get with build_index_type. Create an
open-ended range instead. */
itype = build_range_type (sizetype, size, NULL_TREE);
}
else
{
/* Compute the maximum valid index, that is, size
- 1. Do the calculation in index_type, so that
if it is a variable the computations will be
done in the proper mode. */
itype = fold (build2 (MINUS_EXPR, index_type,
convert (index_type, size),
convert (index_type,
size_one_node)));
/* If that overflowed, the array is too big. ???
While a size of INT_MAX+1 technically shouldn't
cause an overflow (because we subtract 1), the
overflow is recorded during the conversion to
index_type, before the subtraction. Handling
this case seems like an unnecessary
complication. */
if (TREE_OVERFLOW (itype))
{
error ("size of array `%s' is too large", name);
type = error_mark_node;
continue;
}
if (size_varies)
itype = variable_size (itype);
itype = build_index_type (itype);
}
}
else if (decl_context == FIELD)
{
if (pedantic && !flag_isoc99 && !in_system_header)
pedwarn ("ISO C90 does not support flexible array members");
if (pedantic && !COMPLETE_TYPE_P (type)) /* ISO C99 Flexible array members are effectively
pedwarn ("array type has incomplete element type"); identical to GCC's zero-length array extension. */
itype = build_range_type (sizetype, size_zero_node, NULL_TREE);
}
/* Build the array type itself, then merge any constancy or /* If pedantic, complain about arrays of incomplete types. */
volatility into the target type. We must do it in this order if (pedantic && !COMPLETE_TYPE_P (type))
to ensure that the TYPE_MAIN_VARIANT field of the array type pedwarn ("array type has incomplete element type");
is set correctly. */
type = build_array_type (type, itype); /* Build the array type itself, then merge any constancy
if (type_quals) or volatility into the target type. We must do it in
type = c_build_qualified_type (type, type_quals); this order to ensure that the TYPE_MAIN_VARIANT field
of the array type is set correctly. */
type = build_array_type (type, itype);
if (type_quals)
type = c_build_qualified_type (type, type_quals);
if (size_varies) if (size_varies)
C_TYPE_VARIABLE_SIZE (type) = 1; C_TYPE_VARIABLE_SIZE (type) = 1;
/* The GCC extension for zero-length arrays differs from /* The GCC extension for zero-length arrays differs from
ISO flexible array members in that sizeof yields zero. */ ISO flexible array members in that sizeof yields
if (size && integer_zerop (size)) zero. */
{ if (size && integer_zerop (size))
{
layout_type (type);
TYPE_SIZE (type) = bitsize_zero_node;
TYPE_SIZE_UNIT (type) = size_zero_node;
}
else if (declarator && TREE_CODE (declarator) == INDIRECT_REF)
/* We can never complete an array type which is the
target of a pointer, so go ahead and lay it out. */
layout_type (type); layout_type (type);
TYPE_SIZE (type) = bitsize_zero_node;
TYPE_SIZE_UNIT (type) = size_zero_node;
}
else if (declarator && TREE_CODE (declarator) == INDIRECT_REF)
/* We can never complete an array type which is the target of a
pointer, so go ahead and lay it out. */
layout_type (type);
if (decl_context != PARM
&& (array_ptr_quals != NULL_TREE || array_parm_static))
{
error ("static or type qualifiers in non-parameter array declarator");
array_ptr_quals = NULL_TREE;
array_parm_static = 0;
}
}
else if (TREE_CODE (declarator) == CALL_EXPR)
{
/* Say it's a definition only for the declarator closest to
the identifier, apart possibly from some attributes. */
bool really_funcdef = false;
tree arg_types;
if (funcdef_flag)
{
tree t = TREE_OPERAND (declarator, 0);
while (TREE_CODE (t) == TREE_LIST)
t = TREE_VALUE (t);
really_funcdef = (TREE_CODE (t) == IDENTIFIER_NODE);
}
/* Declaring a function type. if (decl_context != PARM
Make sure we have a valid type for the function to return. */ && (array_ptr_quals != NULL_TREE || array_parm_static))
if (type == error_mark_node) {
continue; error ("static or type qualifiers in non-parameter array declarator");
array_ptr_quals = NULL_TREE;
size_varies = 0; array_parm_static = 0;
}
break;
}
case CALL_EXPR:
{
/* Say it's a definition only for the declarator closest
to the identifier, apart possibly from some
attributes. */
bool really_funcdef = false;
tree arg_types;
if (funcdef_flag)
{
tree t = TREE_OPERAND (declarator, 0);
while (TREE_CODE (t) == TREE_LIST)
t = TREE_VALUE (t);
really_funcdef = (TREE_CODE (t) == IDENTIFIER_NODE);
}
/* Warn about some types functions can't return. */ /* Declaring a function type. Make sure we have a valid
type for the function to return. */
if (type == error_mark_node)
continue;
size_varies = 0;
if (TREE_CODE (type) == FUNCTION_TYPE) /* Warn about some types functions can't return. */
{ if (TREE_CODE (type) == FUNCTION_TYPE)
error ("`%s' declared as function returning a function", name); {
type = integer_type_node; error ("`%s' declared as function returning a function", name);
} type = integer_type_node;
if (TREE_CODE (type) == ARRAY_TYPE) }
{ if (TREE_CODE (type) == ARRAY_TYPE)
error ("`%s' declared as function returning an array", name); {
type = integer_type_node; error ("`%s' declared as function returning an array", name);
} type = integer_type_node;
}
/* Construct the function type and go to the next /* Construct the function type and go to the next
inner layer of declarator. */ inner layer of declarator. */
arg_info = TREE_OPERAND (declarator, 1); arg_info = TREE_OPERAND (declarator, 1);
arg_types = grokparms (arg_info, really_funcdef); arg_types = grokparms (arg_info, really_funcdef);
/* Type qualifiers before the return type of the function /* Type qualifiers before the return type of the function
qualify the return type, not the function type. */ qualify the return type, not the function type. */
if (type_quals) if (type_quals)
{
/* Type qualifiers on a function return type are
normally permitted by the standard but have no
effect, so give a warning at -Wreturn-type.
Qualifiers on a void return type are banned on
function definitions in ISO C; GCC used to used
them for noreturn functions. */
if (VOID_TYPE_P (type) && really_funcdef)
pedwarn ("function definition has qualified void return type");
else if (warn_return_type)
warning ("type qualifiers ignored on function return type");
type = c_build_qualified_type (type, type_quals);
}
type_quals = TYPE_UNQUALIFIED;
type = build_function_type (type, arg_types);
declarator = TREE_OPERAND (declarator, 0);
/* Set the TYPE_CONTEXTs for each tagged type which is local to
the formal parameter list of this FUNCTION_TYPE to point to
the FUNCTION_TYPE node itself. */
{ {
/* Type qualifiers on a function return type are tree link;
normally permitted by the standard but have no
effect, so give a warning at -Wreturn-type. for (link = ARG_INFO_TAGS (arg_info);
Qualifiers on a void return type are banned on link;
function definitions in ISO C; GCC used to used them link = TREE_CHAIN (link))
for noreturn functions. */ TYPE_CONTEXT (TREE_VALUE (link)) = type;
if (VOID_TYPE_P (type) && really_funcdef)
pedwarn ("function definition has qualified void return type");
else if (warn_return_type)
warning ("type qualifiers ignored on function return type");
type = c_build_qualified_type (type, type_quals);
} }
type_quals = TYPE_UNQUALIFIED; break;
}
type = build_function_type (type, arg_types); case INDIRECT_REF:
declarator = TREE_OPERAND (declarator, 0);
/* Set the TYPE_CONTEXTs for each tagged type which is local to
the formal parameter list of this FUNCTION_TYPE to point to
the FUNCTION_TYPE node itself. */
{ {
tree link; /* Merge any constancy or volatility into the target type
for the pointer. */
for (link = ARG_INFO_TAGS (arg_info); if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
link; && type_quals)
link = TREE_CHAIN (link)) pedwarn ("ISO C forbids qualified function types");
TYPE_CONTEXT (TREE_VALUE (link)) = type; if (type_quals)
type = c_build_qualified_type (type, type_quals);
type_quals = TYPE_UNQUALIFIED;
size_varies = 0;
type = build_pointer_type (type);
/* Process a list of type modifier keywords (such as const
or volatile) that were given inside the `*'. */
if (TREE_TYPE (declarator))
{
tree typemodlist;
int erred = 0;
constp = 0;
volatilep = 0;
restrictp = 0;
for (typemodlist = TREE_TYPE (declarator); typemodlist;
typemodlist = TREE_CHAIN (typemodlist))
{
tree qualifier = TREE_VALUE (typemodlist);
if (C_IS_RESERVED_WORD (qualifier))
{
if (C_RID_CODE (qualifier) == RID_CONST)
constp++;
else if (C_RID_CODE (qualifier) == RID_VOLATILE)
volatilep++;
else if (C_RID_CODE (qualifier) == RID_RESTRICT)
restrictp++;
else
erred++;
}
else
erred++;
}
if (erred)
error ("invalid type modifier within pointer declarator");
if (pedantic && !flag_isoc99)
{
if (constp > 1)
pedwarn ("duplicate `const'");
if (volatilep > 1)
pedwarn ("duplicate `volatile'");
if (restrictp > 1)
pedwarn ("duplicate `restrict'");
}
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
| (volatilep ? TYPE_QUAL_VOLATILE : 0));
}
declarator = TREE_OPERAND (declarator, 0);
break;
} }
default:
gcc_unreachable ();
} }
else if (TREE_CODE (declarator) == INDIRECT_REF)
{
/* Merge any constancy or volatility into the target type
for the pointer. */
if (pedantic && TREE_CODE (type) == FUNCTION_TYPE
&& type_quals)
pedwarn ("ISO C forbids qualified function types");
if (type_quals)
type = c_build_qualified_type (type, type_quals);
type_quals = TYPE_UNQUALIFIED;
size_varies = 0;
type = build_pointer_type (type);
/* Process a list of type modifier keywords
(such as const or volatile) that were given inside the `*'. */
if (TREE_TYPE (declarator))
{
tree typemodlist;
int erred = 0;
constp = 0;
volatilep = 0;
restrictp = 0;
for (typemodlist = TREE_TYPE (declarator); typemodlist;
typemodlist = TREE_CHAIN (typemodlist))
{
tree qualifier = TREE_VALUE (typemodlist);
if (C_IS_RESERVED_WORD (qualifier))
{
if (C_RID_CODE (qualifier) == RID_CONST)
constp++;
else if (C_RID_CODE (qualifier) == RID_VOLATILE)
volatilep++;
else if (C_RID_CODE (qualifier) == RID_RESTRICT)
restrictp++;
else
erred++;
}
else
erred++;
}
if (erred)
error ("invalid type modifier within pointer declarator");
if (pedantic && !flag_isoc99)
{
if (constp > 1)
pedwarn ("duplicate `const'");
if (volatilep > 1)
pedwarn ("duplicate `volatile'");
if (restrictp > 1)
pedwarn ("duplicate `restrict'");
}
type_quals = ((constp ? TYPE_QUAL_CONST : 0)
| (restrictp ? TYPE_QUAL_RESTRICT : 0)
| (volatilep ? TYPE_QUAL_VOLATILE : 0));
}
declarator = TREE_OPERAND (declarator, 0);
}
else
abort ();
} }
/* Now TYPE has the actual type. */ /* Now TYPE has the actual type. */
...@@ -4930,12 +4928,9 @@ grokdeclarator (tree declarator, tree declspecs, ...@@ -4930,12 +4928,9 @@ grokdeclarator (tree declarator, tree declspecs,
C_DECL_REGISTER (decl) = was_reg; C_DECL_REGISTER (decl) = was_reg;
} }
#ifdef ENABLE_CHECKING
/* This is the earliest point at which we might know the assembler /* This is the earliest point at which we might know the assembler
name of a variable. Thus, if it's known before this, die horribly. */ name of a variable. Thus, if it's known before this, die horribly. */
if (DECL_ASSEMBLER_NAME_SET_P (decl)) gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl));
abort ();
#endif
decl_attributes (&decl, returned_attrs, 0); decl_attributes (&decl, returned_attrs, 0);
...@@ -5059,10 +5054,7 @@ get_parm_info (bool ellipsis) ...@@ -5059,10 +5054,7 @@ get_parm_info (bool ellipsis)
/* This function is only called if there was *something* on the /* This function is only called if there was *something* on the
parameter list. */ parameter list. */
#ifdef ENABLE_CHECKING gcc_assert (b);
if (b == 0)
abort ();
#endif
/* A parameter list consisting solely of 'void' indicates that the /* A parameter list consisting solely of 'void' indicates that the
function takes no arguments. But if the 'void' is qualified function takes no arguments. But if the 'void' is qualified
...@@ -5103,9 +5095,7 @@ get_parm_info (bool ellipsis) ...@@ -5103,9 +5095,7 @@ get_parm_info (bool ellipsis)
case PARM_DECL: case PARM_DECL:
if (b->id) if (b->id)
{ {
#ifdef ENABLE_CHECKING gcc_assert (I_SYMBOL_BINDING (b->id) == b);
if (I_SYMBOL_BINDING (b->id) != b) abort ();
#endif
I_SYMBOL_BINDING (b->id) = b->shadowed; I_SYMBOL_BINDING (b->id) = b->shadowed;
} }
...@@ -5143,9 +5133,7 @@ get_parm_info (bool ellipsis) ...@@ -5143,9 +5133,7 @@ get_parm_info (bool ellipsis)
appears in the bindings list with b->id NULL. */ appears in the bindings list with b->id NULL. */
if (b->id) if (b->id)
{ {
#ifdef ENABLE_CHECKING gcc_assert (I_TAG_BINDING (b->id) == b);
if (I_TAG_BINDING (b->id) != b) abort ();
#endif
I_TAG_BINDING (b->id) = b->shadowed; I_TAG_BINDING (b->id) = b->shadowed;
} }
...@@ -5192,9 +5180,7 @@ get_parm_info (bool ellipsis) ...@@ -5192,9 +5180,7 @@ get_parm_info (bool ellipsis)
variable. Just throw it away. */ variable. Just throw it away. */
if (b->id) if (b->id)
{ {
#ifdef ENABLE_CHECKING gcc_assert (I_SYMBOL_BINDING (b->id) == b);
if (I_SYMBOL_BINDING (b->id) != b) abort ();
#endif
I_SYMBOL_BINDING (b->id) = b->shadowed; I_SYMBOL_BINDING (b->id) = b->shadowed;
} }
break; break;
...@@ -5204,7 +5190,7 @@ get_parm_info (bool ellipsis) ...@@ -5204,7 +5190,7 @@ get_parm_info (bool ellipsis)
case FUNCTION_DECL: case FUNCTION_DECL:
case VAR_DECL: case VAR_DECL:
default: default:
abort (); gcc_unreachable ();
} }
b = free_binding_and_advance (b); b = free_binding_and_advance (b);
...@@ -6054,12 +6040,9 @@ start_function (tree declspecs, tree declarator, tree attributes) ...@@ -6054,12 +6040,9 @@ start_function (tree declspecs, tree declarator, tree attributes)
if (current_function_decl != 0) if (current_function_decl != 0)
TREE_PUBLIC (decl1) = 0; TREE_PUBLIC (decl1) = 0;
#ifdef ENABLE_CHECKING
/* This is the earliest point at which we might know the assembler /* This is the earliest point at which we might know the assembler
name of the function. Thus, if it's set before this, die horribly. */ name of the function. Thus, if it's set before this, die horribly. */
if (DECL_ASSEMBLER_NAME_SET_P (decl1)) gcc_assert (!DECL_ASSEMBLER_NAME_SET_P (decl1));
abort ();
#endif
/* If #pragma weak was used, mark the decl weak now. */ /* If #pragma weak was used, mark the decl weak now. */
if (current_scope == file_scope) if (current_scope == file_scope)
...@@ -6229,8 +6212,7 @@ store_parm_decls_oldstyle (tree fndecl, tree arg_info) ...@@ -6229,8 +6212,7 @@ store_parm_decls_oldstyle (tree fndecl, tree arg_info)
seen already, since it is not used on PARM_DECL. */ seen already, since it is not used on PARM_DECL. */
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
for (b = current_scope->bindings; b; b = b->prev) for (b = current_scope->bindings; b; b = b->prev)
if (TREE_CODE (b->decl) == PARM_DECL && DECL_WEAK (b->decl)) gcc_assert (TREE_CODE (b->decl) != PARM_DECL || !DECL_WEAK (b->decl));
abort ();
#endif #endif
if (warn_old_style_definition && !in_system_header) if (warn_old_style_definition && !in_system_header)
...@@ -6991,8 +6973,7 @@ c_write_global_declarations (void) ...@@ -6991,8 +6973,7 @@ c_write_global_declarations (void)
/* Close the external scope. */ /* Close the external scope. */
ext_block = pop_scope (); ext_block = pop_scope ();
external_scope = 0; external_scope = 0;
if (current_scope) gcc_assert (!current_scope);
abort ();
/* Process all file scopes in this compilation, and the external_scope, /* Process all file scopes in this compilation, and the external_scope,
through wrapup_global_declarations and check_global_declarations. */ through wrapup_global_declarations and check_global_declarations. */
......
...@@ -151,7 +151,7 @@ check_format_string (tree argument, unsigned HOST_WIDE_INT format_num, ...@@ -151,7 +151,7 @@ check_format_string (tree argument, unsigned HOST_WIDE_INT format_num,
and store its value. If validated_p is true, abort on errors. and store its value. If validated_p is true, abort on errors.
Returns true on success, false otherwise. */ Returns true on success, false otherwise. */
static bool static bool
get_constant(tree expr, unsigned HOST_WIDE_INT *value, int validated_p) get_constant (tree expr, unsigned HOST_WIDE_INT *value, int validated_p)
{ {
while (TREE_CODE (expr) == NOP_EXPR while (TREE_CODE (expr) == NOP_EXPR
|| TREE_CODE (expr) == CONVERT_EXPR || TREE_CODE (expr) == CONVERT_EXPR
...@@ -160,8 +160,7 @@ get_constant(tree expr, unsigned HOST_WIDE_INT *value, int validated_p) ...@@ -160,8 +160,7 @@ get_constant(tree expr, unsigned HOST_WIDE_INT *value, int validated_p)
if (TREE_CODE (expr) != INTEGER_CST || TREE_INT_CST_HIGH (expr) != 0) if (TREE_CODE (expr) != INTEGER_CST || TREE_INT_CST_HIGH (expr) != 0)
{ {
if (validated_p) gcc_assert (!validated_p);
abort ();
return false; return false;
} }
...@@ -187,8 +186,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p) ...@@ -187,8 +186,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p)
if (TREE_CODE (format_type_id) != IDENTIFIER_NODE) if (TREE_CODE (format_type_id) != IDENTIFIER_NODE)
{ {
if (validated_p) gcc_assert (!validated_p);
abort ();
error ("unrecognized format specifier"); error ("unrecognized format specifier");
return false; return false;
} }
...@@ -200,8 +198,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p) ...@@ -200,8 +198,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p)
if (info->format_type == format_type_error) if (info->format_type == format_type_error)
{ {
if (validated_p) gcc_assert (!validated_p);
abort ();
warning ("%qs is an unrecognized format function type", p); warning ("%qs is an unrecognized format function type", p);
return false; return false;
} }
...@@ -221,8 +218,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p) ...@@ -221,8 +218,7 @@ decode_format_attr (tree args, function_format_info *info, int validated_p)
if (info->first_arg_num != 0 && info->first_arg_num <= info->format_num) if (info->first_arg_num != 0 && info->first_arg_num <= info->format_num)
{ {
if (validated_p) gcc_assert (!validated_p);
abort ();
error ("format string arg follows the args to be formatted"); error ("format string arg follows the args to be formatted");
return false; return false;
} }
...@@ -1004,11 +1000,8 @@ maybe_read_dollar_number (const char **format, ...@@ -1004,11 +1000,8 @@ maybe_read_dollar_number (const char **format,
for (i = 1; i < argnum && *param_ptr != 0; i++) for (i = 1; i < argnum && *param_ptr != 0; i++)
*param_ptr = TREE_CHAIN (*param_ptr); *param_ptr = TREE_CHAIN (*param_ptr);
if (*param_ptr == 0) /* This case shouldn't be caught here. */
{ gcc_assert (*param_ptr);
/* This case shouldn't be caught here. */
abort ();
}
} }
else else
*param_ptr = 0; *param_ptr = 0;
...@@ -1096,10 +1089,8 @@ get_flag_spec (const format_flag_spec *spec, int flag, const char *predicates) ...@@ -1096,10 +1089,8 @@ get_flag_spec (const format_flag_spec *spec, int flag, const char *predicates)
else if (spec[i].predicate == 0) else if (spec[i].predicate == 0)
return &spec[i]; return &spec[i];
} }
if (predicates == NULL) gcc_assert (predicates);
abort (); return NULL;
else
return NULL;
} }
...@@ -1299,8 +1290,8 @@ check_format_arg (void *ctx, tree format_tree, ...@@ -1299,8 +1290,8 @@ check_format_arg (void *ctx, tree format_tree,
if (array_size != 0) if (array_size != 0)
{ {
/* Variable length arrays can't be initialized. */ /* Variable length arrays can't be initialized. */
if (TREE_CODE (array_size) != INTEGER_CST) gcc_assert (TREE_CODE (array_size) == INTEGER_CST);
abort ();
if (host_integerp (array_size, 0)) if (host_integerp (array_size, 0))
{ {
HOST_WIDE_INT array_size_value = TREE_INT_CST_LOW (array_size); HOST_WIDE_INT array_size_value = TREE_INT_CST_LOW (array_size);
...@@ -2053,10 +2044,8 @@ check_format_types (format_wanted_type *types, const char *format_start, ...@@ -2053,10 +2044,8 @@ check_format_types (format_wanted_type *types, const char *format_start,
arg_num = types->arg_num; arg_num = types->arg_num;
/* The following should not occur here. */ /* The following should not occur here. */
if (wanted_type == 0) gcc_assert (wanted_type);
abort (); gcc_assert (wanted_type != void_type_node || types->pointer_count);
if (wanted_type == void_type_node && types->pointer_count == 0)
abort ();
if (types->pointer_count == 0) if (types->pointer_count == 0)
wanted_type = lang_hooks.types.type_promotes_to (wanted_type); wanted_type = lang_hooks.types.type_promotes_to (wanted_type);
...@@ -2253,17 +2242,14 @@ format_type_warning (const char *descr, const char *format_start, ...@@ -2253,17 +2242,14 @@ format_type_warning (const char *descr, const char *format_start,
static unsigned int static unsigned int
find_char_info_specifier_index (const format_char_info *fci, int c) find_char_info_specifier_index (const format_char_info *fci, int c)
{ {
unsigned int i = 0; unsigned i;
while (fci->format_chars) for (i = 0; fci->format_chars; i++, fci++)
{ if (strchr (fci->format_chars, c))
if (strchr (fci->format_chars, c)) return i;
return i;
i++; fci++;
}
/* We shouldn't be looking for a non-existent specifier. */ /* We shouldn't be looking for a non-existent specifier. */
abort (); gcc_unreachable ();
} }
/* Given a format_length_info array FLI, and a character C, this /* Given a format_length_info array FLI, and a character C, this
...@@ -2273,17 +2259,14 @@ find_char_info_specifier_index (const format_char_info *fci, int c) ...@@ -2273,17 +2259,14 @@ find_char_info_specifier_index (const format_char_info *fci, int c)
static unsigned int static unsigned int
find_length_info_modifier_index (const format_length_info *fli, int c) find_length_info_modifier_index (const format_length_info *fli, int c)
{ {
unsigned int i = 0; unsigned i;
while (fli->name) for (i = 0; fli->name; i++, fli++)
{ if (strchr (fli->name, c))
if (strchr (fli->name, c)) return i;
return i;
i++; fli++;
}
/* We shouldn't be looking for a non-existent modifier. */ /* We shouldn't be looking for a non-existent modifier. */
abort (); gcc_unreachable ();
} }
/* Determine the type of HOST_WIDE_INT in the code being compiled for /* Determine the type of HOST_WIDE_INT in the code being compiled for
...@@ -2293,7 +2276,7 @@ static void ...@@ -2293,7 +2276,7 @@ static void
init_dynamic_asm_fprintf_info (void) init_dynamic_asm_fprintf_info (void)
{ {
static tree hwi; static tree hwi;
if (!hwi) if (!hwi)
{ {
format_length_info *new_asm_fprintf_length_specs; format_length_info *new_asm_fprintf_length_specs;
...@@ -2303,9 +2286,10 @@ init_dynamic_asm_fprintf_info (void) ...@@ -2303,9 +2286,10 @@ init_dynamic_asm_fprintf_info (void)
length modifier to work, one must have issued: "typedef length modifier to work, one must have issued: "typedef
HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code HOST_WIDE_INT __gcc_host_wide_int__;" in one's source code
prior to using that modifier. */ prior to using that modifier. */
if (!(hwi = maybe_get_identifier ("__gcc_host_wide_int__")) hwi = maybe_get_identifier ("__gcc_host_wide_int__");
|| !(hwi = DECL_ORIGINAL_TYPE (identifier_global_value (hwi)))) gcc_assert (hwi);
abort (); hwi = DECL_ORIGINAL_TYPE (identifier_global_value (hwi));
gcc_assert (hwi);
/* Create a new (writable) copy of asm_fprintf_length_specs. */ /* Create a new (writable) copy of asm_fprintf_length_specs. */
new_asm_fprintf_length_specs = (format_length_info *) new_asm_fprintf_length_specs = (format_length_info *)
...@@ -2320,7 +2304,7 @@ init_dynamic_asm_fprintf_info (void) ...@@ -2320,7 +2304,7 @@ init_dynamic_asm_fprintf_info (void)
else if (hwi == long_long_integer_type_node) else if (hwi == long_long_integer_type_node)
new_asm_fprintf_length_specs[i].index = FMT_LEN_ll; new_asm_fprintf_length_specs[i].index = FMT_LEN_ll;
else else
abort (); gcc_unreachable ();
/* Assign the new data for use. */ /* Assign the new data for use. */
dynamic_format_types[asm_fprintf_format_type].length_char_specs = dynamic_format_types[asm_fprintf_format_type].length_char_specs =
...@@ -2383,7 +2367,7 @@ init_dynamic_diag_info (void) ...@@ -2383,7 +2367,7 @@ init_dynamic_diag_info (void)
else if (hwi == long_long_integer_type_node) else if (hwi == long_long_integer_type_node)
diag_ls[i].index = FMT_LEN_ll; diag_ls[i].index = FMT_LEN_ll;
else else
abort (); gcc_unreachable ();
} }
/* Handle the __gcc_diag__ format specifics. */ /* Handle the __gcc_diag__ format specifics. */
...@@ -2551,7 +2535,7 @@ handle_format_attribute (tree *node, tree ARG_UNUSED (name), tree args, ...@@ -2551,7 +2535,7 @@ handle_format_attribute (tree *node, tree ARG_UNUSED (name), tree args,
|| info.format_type == gcc_cxxdiag_format_type) || info.format_type == gcc_cxxdiag_format_type)
init_dynamic_diag_info(); init_dynamic_diag_info();
else else
abort(); gcc_unreachable();
} }
return NULL_TREE; return NULL_TREE;
......
...@@ -84,8 +84,7 @@ static struct c_gimplify_ctx ...@@ -84,8 +84,7 @@ static struct c_gimplify_ctx
static void static void
push_context (void) push_context (void)
{ {
if (ctxp) gcc_assert (!ctxp);
abort ();
ctxp = (struct c_gimplify_ctx *) xcalloc (1, sizeof (struct c_gimplify_ctx)); ctxp = (struct c_gimplify_ctx *) xcalloc (1, sizeof (struct c_gimplify_ctx));
ctxp->bc_id[bc_continue] = get_identifier ("continue"); ctxp->bc_id[bc_continue] = get_identifier ("continue");
ctxp->bc_id[bc_break] = get_identifier ("break"); ctxp->bc_id[bc_break] = get_identifier ("break");
...@@ -94,8 +93,7 @@ push_context (void) ...@@ -94,8 +93,7 @@ push_context (void)
static void static void
pop_context (void) pop_context (void)
{ {
if (!ctxp || ctxp->current_bc_label) gcc_assert (ctxp && !ctxp->current_bc_label);
abort ();
free (ctxp); free (ctxp);
ctxp = NULL; ctxp = NULL;
} }
...@@ -275,8 +273,7 @@ begin_bc_block (enum bc_t bc) ...@@ -275,8 +273,7 @@ begin_bc_block (enum bc_t bc)
static tree static tree
finish_bc_block (tree label, tree body) finish_bc_block (tree label, tree body)
{ {
if (label != ctxp->current_bc_label) gcc_assert (label == ctxp->current_bc_label);
abort ();
if (TREE_USED (label)) if (TREE_USED (label))
{ {
......
...@@ -373,7 +373,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags) ...@@ -373,7 +373,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
break; break;
default: default:
abort (); gcc_unreachable ();
} }
} }
break; break;
...@@ -435,7 +435,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags) ...@@ -435,7 +435,7 @@ c_lex_with_flags (tree *value, unsigned char *cpp_flags)
case CPP_HEADER_NAME: case CPP_HEADER_NAME:
case CPP_COMMENT: case CPP_COMMENT:
case CPP_MACRO_ARG: case CPP_MACRO_ARG:
abort (); gcc_unreachable ();
default: default:
*value = NULL_TREE; *value = NULL_TREE;
...@@ -737,12 +737,11 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string) ...@@ -737,12 +737,11 @@ lex_string (const cpp_token *tok, tree *valp, bool objc_string)
if (c_lex_string_translate == -1) if (c_lex_string_translate == -1)
{ {
if (!cpp_interpret_string_notranslate (parse_in, strs, count, int xlated = cpp_interpret_string_notranslate (parse_in, strs, count,
&istr, wide)) &istr, wide);
/* Assume that, if we managed to translate the string /* Assume that, if we managed to translate the string above,
above, then the untranslated parsing will always then the untranslated parsing will always succeed. */
succeed. */ gcc_assert (xlated);
abort ();
if (TREE_STRING_LENGTH (value) != (int)istr.len if (TREE_STRING_LENGTH (value) != (int)istr.len
|| 0 != strncmp (TREE_STRING_POINTER (value), (char *)istr.text, || 0 != strncmp (TREE_STRING_POINTER (value), (char *)istr.text,
......
...@@ -213,10 +213,9 @@ c_tree_printer (pretty_printer *pp, text_info *text) ...@@ -213,10 +213,9 @@ c_tree_printer (pretty_printer *pp, text_info *text)
break; break;
case 'T': case 'T':
if (TYPE_P (t)) gcc_assert (TYPE_P (t));
name = TYPE_NAME (t); name = TYPE_NAME (t);
else
abort ();
if (name && TREE_CODE (name) == TYPE_DECL) if (name && TREE_CODE (name) == TYPE_DECL)
{ {
if (DECL_NAME (name)) if (DECL_NAME (name))
......
...@@ -129,10 +129,10 @@ pch_init (void) ...@@ -129,10 +129,10 @@ pch_init (void)
if (f == NULL) if (f == NULL)
fatal_error ("can't create precompiled header %s: %m", pch_file); fatal_error ("can't create precompiled header %s: %m", pch_file);
pch_outfile = f; pch_outfile = f;
if (strlen (host_machine) > 255 || strlen (target_machine) > 255 gcc_assert (strlen (host_machine) < 256
|| strlen (version_string) > 255) && strlen (target_machine) < 256
abort (); && strlen (version_string) < 256);
v.host_machine_length = strlen (host_machine); v.host_machine_length = strlen (host_machine);
v.target_machine_length = strlen (target_machine); v.target_machine_length = strlen (target_machine);
...@@ -143,8 +143,7 @@ pch_init (void) ...@@ -143,8 +143,7 @@ pch_init (void)
for (i = 0; i < MATCH_SIZE; i++) for (i = 0; i < MATCH_SIZE; i++)
{ {
v.match[i] = *pch_matching[i].flag_var; v.match[i] = *pch_matching[i].flag_var;
if (v.match[i] != *pch_matching[i].flag_var) gcc_assert (v.match[i] == *pch_matching[i].flag_var);
abort ();
} }
} }
v.pch_init = &pch_init; v.pch_init = &pch_init;
......
...@@ -279,7 +279,7 @@ maybe_apply_pragma_weak (tree decl) ...@@ -279,7 +279,7 @@ maybe_apply_pragma_weak (tree decl)
return; return;
/* If it's not a function or a variable, it can't be weak. /* If it's not a function or a variable, it can't be weak.
FIXME: what kinds of things are visible outside this file but FIXME: what kinds of things are visible outside this file but
aren't functions or variables? Should this be an abort() instead? */ aren't functions or variables? Should this be an assert instead? */
if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL)
return; return;
......
...@@ -2139,8 +2139,7 @@ pp_c_tree_decl_identifier (c_pretty_printer *pp, tree t) ...@@ -2139,8 +2139,7 @@ pp_c_tree_decl_identifier (c_pretty_printer *pp, tree t)
{ {
const char *name; const char *name;
if (!DECL_P (t)) gcc_assert (DECL_P (t));
abort ();
if (DECL_NAME (t)) if (DECL_NAME (t))
name = IDENTIFIER_POINTER (DECL_NAME (t)); name = IDENTIFIER_POINTER (DECL_NAME (t));
......
...@@ -157,7 +157,7 @@ c_incomplete_type_error (tree value, tree type) ...@@ -157,7 +157,7 @@ c_incomplete_type_error (tree value, tree type)
return; return;
default: default:
abort (); gcc_unreachable ();
} }
if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE) if (TREE_CODE (TYPE_NAME (type)) == IDENTIFIER_NODE)
...@@ -240,8 +240,7 @@ composite_type (tree t1, tree t2) ...@@ -240,8 +240,7 @@ composite_type (tree t1, tree t2)
if (code2 == ENUMERAL_TYPE && code1 == INTEGER_TYPE) if (code2 == ENUMERAL_TYPE && code1 == INTEGER_TYPE)
return t2; return t2;
if (code1 != code2) gcc_assert (code1 == code2);
abort ();
switch (code1) switch (code1)
{ {
...@@ -261,8 +260,7 @@ composite_type (tree t1, tree t2) ...@@ -261,8 +260,7 @@ composite_type (tree t1, tree t2)
tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2)); tree elt = composite_type (TREE_TYPE (t1), TREE_TYPE (t2));
/* We should not have any type quals on arrays at all. */ /* We should not have any type quals on arrays at all. */
if (TYPE_QUALS (t1) || TYPE_QUALS (t2)) gcc_assert (!TYPE_QUALS (t1) && !TYPE_QUALS (t2));
abort ();
/* Save space: see if the result is identical to one of the args. */ /* Save space: see if the result is identical to one of the args. */
if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1)) if (elt == TREE_TYPE (t1) && TYPE_DOMAIN (t1))
...@@ -412,8 +410,8 @@ common_pointer_type (tree t1, tree t2) ...@@ -412,8 +410,8 @@ common_pointer_type (tree t1, tree t2)
if (t2 == error_mark_node) if (t2 == error_mark_node)
return t1; return t1;
if (TREE_CODE (t1) != POINTER_TYPE || TREE_CODE (t2) != POINTER_TYPE) gcc_assert (TREE_CODE (t1) == POINTER_TYPE
abort (); && TREE_CODE (t2) == POINTER_TYPE);
/* Merge the attributes. */ /* Merge the attributes. */
attributes = targetm.merge_type_attributes (t1, t2); attributes = targetm.merge_type_attributes (t1, t2);
...@@ -470,13 +468,10 @@ common_type (tree t1, tree t2) ...@@ -470,13 +468,10 @@ common_type (tree t1, tree t2)
code1 = TREE_CODE (t1); code1 = TREE_CODE (t1);
code2 = TREE_CODE (t2); code2 = TREE_CODE (t2);
if (code1 != VECTOR_TYPE && code1 != COMPLEX_TYPE gcc_assert (code1 == VECTOR_TYPE || code1 == COMPLEX_TYPE
&& code1 != REAL_TYPE && code1 != INTEGER_TYPE) || code1 == REAL_TYPE || code1 == INTEGER_TYPE);
abort (); gcc_assert (code2 == VECTOR_TYPE || code2 == COMPLEX_TYPE
|| code2 == REAL_TYPE || code2 == INTEGER_TYPE);
if (code2 != VECTOR_TYPE && code2 != COMPLEX_TYPE
&& code2 != REAL_TYPE && code2 != INTEGER_TYPE)
abort ();
/* If one type is a vector type, return that type. (How the usual /* If one type is a vector type, return that type. (How the usual
arithmetic conversions apply to the vector types extension is not arithmetic conversions apply to the vector types extension is not
...@@ -744,7 +739,7 @@ same_translation_unit_p (tree t1, tree t2) ...@@ -744,7 +739,7 @@ same_translation_unit_p (tree t1, tree t2)
case 'd': t1 = DECL_CONTEXT (t1); break; case 'd': t1 = DECL_CONTEXT (t1); break;
case 't': t1 = TYPE_CONTEXT (t1); break; case 't': t1 = TYPE_CONTEXT (t1); break;
case 'x': t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */ case 'x': t1 = BLOCK_SUPERCONTEXT (t1); break; /* assume block */
default: abort (); default: gcc_unreachable ();
} }
while (t2 && TREE_CODE (t2) != TRANSLATION_UNIT_DECL) while (t2 && TREE_CODE (t2) != TRANSLATION_UNIT_DECL)
...@@ -753,7 +748,7 @@ same_translation_unit_p (tree t1, tree t2) ...@@ -753,7 +748,7 @@ same_translation_unit_p (tree t1, tree t2)
case 'd': t2 = DECL_CONTEXT (t2); break; case 'd': t2 = DECL_CONTEXT (t2); break;
case 't': t2 = TYPE_CONTEXT (t2); break; case 't': t2 = TYPE_CONTEXT (t2); break;
case 'x': t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */ case 'x': t2 = BLOCK_SUPERCONTEXT (t2); break; /* assume block */
default: abort (); default: gcc_unreachable ();
} }
return t1 == t2; return t1 == t2;
...@@ -935,7 +930,7 @@ tagged_types_tu_compatible_p (tree t1, tree t2) ...@@ -935,7 +930,7 @@ tagged_types_tu_compatible_p (tree t1, tree t2)
} }
default: default:
abort (); gcc_unreachable ();
} }
} }
...@@ -4371,8 +4366,7 @@ finish_init (void) ...@@ -4371,8 +4366,7 @@ finish_init (void)
free (q); free (q);
} }
if (constructor_range_stack) gcc_assert (!constructor_range_stack);
abort ();
/* Pop back to the data of the outer initializer (if any). */ /* Pop back to the data of the outer initializer (if any). */
free (spelling_base); free (spelling_base);
...@@ -4716,8 +4710,7 @@ pop_init_level (int implicit) ...@@ -4716,8 +4710,7 @@ pop_init_level (int implicit)
while (constructor_stack->implicit) while (constructor_stack->implicit)
process_init_element (pop_init_level (1)); process_init_element (pop_init_level (1));
if (constructor_range_stack) gcc_assert (!constructor_range_stack);
abort ();
} }
/* Now output all pending elements. */ /* Now output all pending elements. */
...@@ -4737,8 +4730,10 @@ pop_init_level (int implicit) ...@@ -4737,8 +4730,10 @@ pop_init_level (int implicit)
already have pedwarned for empty brackets. */ already have pedwarned for empty brackets. */
if (integer_zerop (constructor_unfilled_index)) if (integer_zerop (constructor_unfilled_index))
constructor_type = NULL_TREE; constructor_type = NULL_TREE;
else if (! TYPE_SIZE (constructor_type)) else
{ {
gcc_assert (!TYPE_SIZE (constructor_type));
if (constructor_depth > 2) if (constructor_depth > 2)
error_init ("initialization of flexible array member in a nested context"); error_init ("initialization of flexible array member in a nested context");
else if (pedantic) else if (pedantic)
...@@ -4750,10 +4745,6 @@ pop_init_level (int implicit) ...@@ -4750,10 +4745,6 @@ pop_init_level (int implicit)
if (TREE_CHAIN (constructor_fields) != NULL_TREE) if (TREE_CHAIN (constructor_fields) != NULL_TREE)
constructor_type = NULL_TREE; constructor_type = NULL_TREE;
} }
else
/* Zero-length arrays are no longer special, so we should no longer
get here. */
abort ();
} }
/* Warn when some struct elements are implicitly initialized to zero. */ /* Warn when some struct elements are implicitly initialized to zero. */
...@@ -4869,14 +4860,14 @@ set_designator (int array) ...@@ -4869,14 +4860,14 @@ set_designator (int array)
if (constructor_type == 0) if (constructor_type == 0)
return 1; return 1;
/* If there were errors in this designator list already, bail out silently. */ /* If there were errors in this designator list already, bail out
silently. */
if (designator_errorneous) if (designator_errorneous)
return 1; return 1;
if (!designator_depth) if (!designator_depth)
{ {
if (constructor_range_stack) gcc_assert (!constructor_range_stack);
abort ();
/* Designator list starts at the level of closest explicit /* Designator list starts at the level of closest explicit
braces. */ braces. */
...@@ -4892,19 +4883,20 @@ set_designator (int array) ...@@ -4892,19 +4883,20 @@ set_designator (int array)
return 1; return 1;
} }
if (TREE_CODE (constructor_type) == RECORD_TYPE switch (TREE_CODE (constructor_type))
|| TREE_CODE (constructor_type) == UNION_TYPE)
{ {
case RECORD_TYPE:
case UNION_TYPE:
subtype = TREE_TYPE (constructor_fields); subtype = TREE_TYPE (constructor_fields);
if (subtype != error_mark_node) if (subtype != error_mark_node)
subtype = TYPE_MAIN_VARIANT (subtype); subtype = TYPE_MAIN_VARIANT (subtype);
} break;
else if (TREE_CODE (constructor_type) == ARRAY_TYPE) case ARRAY_TYPE:
{
subtype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type)); subtype = TYPE_MAIN_VARIANT (TREE_TYPE (constructor_type));
break;
default:
gcc_unreachable ();
} }
else
abort ();
subcode = TREE_CODE (subtype); subcode = TREE_CODE (subtype);
if (array && subcode != ARRAY_TYPE) if (array && subcode != ARRAY_TYPE)
...@@ -5324,18 +5316,17 @@ set_nonincremental_init_from_string (tree str) ...@@ -5324,18 +5316,17 @@ set_nonincremental_init_from_string (tree str)
const char *p, *end; const char *p, *end;
int byte, wchar_bytes, charwidth, bitpos; int byte, wchar_bytes, charwidth, bitpos;
if (TREE_CODE (constructor_type) != ARRAY_TYPE) gcc_assert (TREE_CODE (constructor_type) == ARRAY_TYPE);
abort ();
if (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str))) if (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str)))
== TYPE_PRECISION (char_type_node)) == TYPE_PRECISION (char_type_node))
wchar_bytes = 1; wchar_bytes = 1;
else if (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str)))
== TYPE_PRECISION (wchar_type_node))
wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
else else
abort (); {
gcc_assert (TYPE_PRECISION (TREE_TYPE (TREE_TYPE (str)))
== TYPE_PRECISION (wchar_type_node));
wchar_bytes = TYPE_PRECISION (wchar_type_node) / BITS_PER_UNIT;
}
charwidth = TYPE_PRECISION (char_type_node); charwidth = TYPE_PRECISION (char_type_node);
type = TREE_TYPE (constructor_type); type = TREE_TYPE (constructor_type);
p = TREE_STRING_POINTER (str); p = TREE_STRING_POINTER (str);
...@@ -6077,16 +6068,14 @@ process_init_element (struct c_expr value) ...@@ -6077,16 +6068,14 @@ process_init_element (struct c_expr value)
constructor_range_stack = 0; constructor_range_stack = 0;
while (constructor_stack != range_stack->stack) while (constructor_stack != range_stack->stack)
{ {
if (!constructor_stack->implicit) gcc_assert (constructor_stack->implicit);
abort ();
process_init_element (pop_init_level (1)); process_init_element (pop_init_level (1));
} }
for (p = range_stack; for (p = range_stack;
!p->range_end || tree_int_cst_equal (p->index, p->range_end); !p->range_end || tree_int_cst_equal (p->index, p->range_end);
p = p->prev) p = p->prev)
{ {
if (!constructor_stack->implicit) gcc_assert (constructor_stack->implicit);
abort ();
process_init_element (pop_init_level (1)); process_init_element (pop_init_level (1));
} }
...@@ -6471,7 +6460,7 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block, ...@@ -6471,7 +6460,7 @@ c_finish_if_stmt (location_t if_locus, tree cond, tree then_block,
inner_if = TREE_OPERAND (inner_if, 0); inner_if = TREE_OPERAND (inner_if, 0);
break; break;
default: default:
abort (); gcc_unreachable ();
} }
found: found:
......
...@@ -160,8 +160,7 @@ init_caller_save (void) ...@@ -160,8 +160,7 @@ init_caller_save (void)
[(int) MODE_BASE_REG_CLASS (regno_save_mode [i][1])], i)) [(int) MODE_BASE_REG_CLASS (regno_save_mode [i][1])], i))
break; break;
if (i == FIRST_PSEUDO_REGISTER) gcc_assert (i < FIRST_PSEUDO_REGISTER);
abort ();
addr_reg = gen_rtx_REG (Pmode, i); addr_reg = gen_rtx_REG (Pmode, i);
...@@ -381,8 +380,7 @@ save_call_clobbered_regs (void) ...@@ -381,8 +380,7 @@ save_call_clobbered_regs (void)
next = chain->next; next = chain->next;
if (chain->is_caller_save_insn) gcc_assert (!chain->is_caller_save_insn);
abort ();
if (INSN_P (insn)) if (INSN_P (insn))
{ {
...@@ -431,22 +429,17 @@ save_call_clobbered_regs (void) ...@@ -431,22 +429,17 @@ save_call_clobbered_regs (void)
{ {
int r = reg_renumber[regno]; int r = reg_renumber[regno];
int nregs; int nregs;
enum machine_mode mode;
if (r >= 0)
{ gcc_assert (r >= 0);
enum machine_mode mode; nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)];
mode = HARD_REGNO_CALLER_SAVE_MODE
nregs = hard_regno_nregs[r][PSEUDO_REGNO_MODE (regno)]; (r, nregs, PSEUDO_REGNO_MODE (regno));
mode = HARD_REGNO_CALLER_SAVE_MODE if (GET_MODE_BITSIZE (mode)
(r, nregs, PSEUDO_REGNO_MODE (regno)); > GET_MODE_BITSIZE (save_mode[r]))
if (GET_MODE_BITSIZE (mode) save_mode[r] = mode;
> GET_MODE_BITSIZE (save_mode[r])) while (nregs-- > 0)
save_mode[r] = mode; SET_HARD_REG_BIT (hard_regs_to_save, r + nregs);
while (nregs-- > 0)
SET_HARD_REG_BIT (hard_regs_to_save, r + nregs);
}
else
abort ();
}); });
/* Record all registers set in this call insn. These don't need /* Record all registers set in this call insn. These don't need
...@@ -650,9 +643,7 @@ insert_restore (struct insn_chain *chain, int before_p, int regno, ...@@ -650,9 +643,7 @@ insert_restore (struct insn_chain *chain, int before_p, int regno,
or SET_SRC. Instead of doing so and causing a crash later, check or SET_SRC. Instead of doing so and causing a crash later, check
for this common case and abort here instead. This will remove one for this common case and abort here instead. This will remove one
step in debugging such problems. */ step in debugging such problems. */
gcc_assert (regno_save_mem[regno][1]);
if (regno_save_mem[regno][1] == 0)
abort ();
/* Get the pattern to emit and update our status. /* Get the pattern to emit and update our status.
...@@ -725,9 +716,7 @@ insert_save (struct insn_chain *chain, int before_p, int regno, ...@@ -725,9 +716,7 @@ insert_save (struct insn_chain *chain, int before_p, int regno,
or SET_SRC. Instead of doing so and causing a crash later, check or SET_SRC. Instead of doing so and causing a crash later, check
for this common case and abort here instead. This will remove one for this common case and abort here instead. This will remove one
step in debugging such problems. */ step in debugging such problems. */
gcc_assert (regno_save_mem[regno][1]);
if (regno_save_mem[regno][1] == 0)
abort ();
/* Get the pattern to emit and update our status. /* Get the pattern to emit and update our status.
...@@ -824,9 +813,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat) ...@@ -824,9 +813,7 @@ insert_one_insn (struct insn_chain *chain, int before_p, int code, rtx pat)
rtx reg = XEXP (link, 0); rtx reg = XEXP (link, 0);
int regno, i; int regno, i;
if (!REG_P (reg)) gcc_assert (REG_P (reg));
abort ();
regno = REGNO (reg); regno = REGNO (reg);
if (regno >= FIRST_PSEUDO_REGISTER) if (regno >= FIRST_PSEUDO_REGISTER)
regno = reg_renumber[regno]; regno = reg_renumber[regno];
......
...@@ -349,7 +349,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED, ...@@ -349,7 +349,7 @@ emit_call_1 (rtx funexp, tree fntree, tree fndecl ATTRIBUTE_UNUSED,
} }
else else
#endif #endif
abort (); gcc_unreachable ();
/* Find the call we just emitted. */ /* Find the call we just emitted. */
call_insn = last_call_insn (); call_insn = last_call_insn ();
...@@ -1158,8 +1158,7 @@ compute_argument_block_size (int reg_parm_stack_space, ...@@ -1158,8 +1158,7 @@ compute_argument_block_size (int reg_parm_stack_space,
/* We don't handle this case yet. To handle it correctly we have /* We don't handle this case yet. To handle it correctly we have
to add the delta, round and subtract the delta. to add the delta, round and subtract the delta.
Currently no machine description requires this support. */ Currently no machine description requires this support. */
if (stack_pointer_delta & (preferred_stack_boundary - 1)) gcc_assert (!(stack_pointer_delta & (preferred_stack_boundary - 1)));
abort ();
args_size->var = round_up (args_size->var, preferred_stack_boundary); args_size->var = round_up (args_size->var, preferred_stack_boundary);
} }
...@@ -1225,8 +1224,7 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args) ...@@ -1225,8 +1224,7 @@ precompute_arguments (int flags, int num_actuals, struct arg_data *args)
enum machine_mode mode; enum machine_mode mode;
/* If this is an addressable type, we cannot pre-evaluate it. */ /* If this is an addressable type, we cannot pre-evaluate it. */
if (TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value))) gcc_assert (!TREE_ADDRESSABLE (TREE_TYPE (args[i].tree_value)));
abort ();
args[i].initial_value = args[i].value args[i].initial_value = args[i].value
= expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0); = expand_expr (args[i].tree_value, NULL_RTX, VOIDmode, 0);
...@@ -1999,8 +1997,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -1999,8 +1997,7 @@ expand_call (tree exp, rtx target, int ignore)
/* Operand 0 is a pointer-to-function; get the type of the function. */ /* Operand 0 is a pointer-to-function; get the type of the function. */
funtype = TREE_TYPE (addr); funtype = TREE_TYPE (addr);
if (! POINTER_TYPE_P (funtype)) gcc_assert (POINTER_TYPE_P (funtype));
abort ();
funtype = TREE_TYPE (funtype); funtype = TREE_TYPE (funtype);
/* Munge the tree to split complex arguments into their imaginary /* Munge the tree to split complex arguments into their imaginary
...@@ -2641,8 +2638,8 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2641,8 +2638,8 @@ expand_call (tree exp, rtx target, int ignore)
now! */ now! */
/* Stack must be properly aligned now. */ /* Stack must be properly aligned now. */
if (pass && stack_pointer_delta % preferred_unit_stack_boundary) gcc_assert (!pass
abort (); || !(stack_pointer_delta % preferred_unit_stack_boundary));
/* Generate the actual call instruction. */ /* Generate the actual call instruction. */
emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size, emit_call_1 (funexp, exp, fndecl, funtype, unadjusted_args_size,
...@@ -2754,8 +2751,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2754,8 +2751,7 @@ expand_call (tree exp, rtx target, int ignore)
{ {
last = PREV_INSN (last); last = PREV_INSN (last);
/* There was no CALL_INSN? */ /* There was no CALL_INSN? */
if (last == before_call) gcc_assert (last != before_call);
abort ();
} }
emit_barrier_after (last); emit_barrier_after (last);
...@@ -2855,36 +2851,36 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2855,36 +2851,36 @@ expand_call (tree exp, rtx target, int ignore)
if (targetm.calls.promote_function_return(funtype)) if (targetm.calls.promote_function_return(funtype))
{ {
/* If we promoted this return value, make the proper SUBREG. TARGET /* If we promoted this return value, make the proper SUBREG.
might be const0_rtx here, so be careful. */ TARGET might be const0_rtx here, so be careful. */
if (REG_P (target) if (REG_P (target)
&& TYPE_MODE (TREE_TYPE (exp)) != BLKmode && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
&& GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp))) && GET_MODE (target) != TYPE_MODE (TREE_TYPE (exp)))
{ {
tree type = TREE_TYPE (exp); tree type = TREE_TYPE (exp);
int unsignedp = TYPE_UNSIGNED (type); int unsignedp = TYPE_UNSIGNED (type);
int offset = 0; int offset = 0;
enum machine_mode pmode;
/* If we don't promote as expected, something is wrong. */
if (GET_MODE (target) pmode = promote_mode (type, TYPE_MODE (type), &unsignedp, 1);
!= promote_mode (type, TYPE_MODE (type), &unsignedp, 1)) /* If we don't promote as expected, something is wrong. */
abort (); gcc_assert (GET_MODE (target) == pmode);
if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN) if ((WORDS_BIG_ENDIAN || BYTES_BIG_ENDIAN)
&& GET_MODE_SIZE (GET_MODE (target)) && (GET_MODE_SIZE (GET_MODE (target))
> GET_MODE_SIZE (TYPE_MODE (type))) > GET_MODE_SIZE (TYPE_MODE (type))))
{ {
offset = GET_MODE_SIZE (GET_MODE (target)) offset = GET_MODE_SIZE (GET_MODE (target))
- GET_MODE_SIZE (TYPE_MODE (type)); - GET_MODE_SIZE (TYPE_MODE (type));
if (! BYTES_BIG_ENDIAN) if (! BYTES_BIG_ENDIAN)
offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD; offset = (offset / UNITS_PER_WORD) * UNITS_PER_WORD;
else if (! WORDS_BIG_ENDIAN) else if (! WORDS_BIG_ENDIAN)
offset %= UNITS_PER_WORD; offset %= UNITS_PER_WORD;
} }
target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset); target = gen_rtx_SUBREG (TYPE_MODE (type), target, offset);
SUBREG_PROMOTED_VAR_P (target) = 1; SUBREG_PROMOTED_VAR_P (target) = 1;
SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp); SUBREG_PROMOTED_UNSIGNED_SET (target, unsignedp);
} }
} }
/* If size of args is variable or this was a constructor call for a stack /* If size of args is variable or this was a constructor call for a stack
...@@ -2971,10 +2967,9 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2971,10 +2967,9 @@ expand_call (tree exp, rtx target, int ignore)
normal_call_insns = insns; normal_call_insns = insns;
/* Verify that we've deallocated all the stack we used. */ /* Verify that we've deallocated all the stack we used. */
if (! (flags & (ECF_NORETURN | ECF_LONGJMP)) gcc_assert ((flags & (ECF_NORETURN | ECF_LONGJMP))
&& old_stack_allocated != stack_pointer_delta || (old_stack_allocated
- pending_stack_adjust) == stack_pointer_delta - pending_stack_adjust));
abort ();
} }
/* If something prevents making this a sibling call, /* If something prevents making this a sibling call,
...@@ -3286,6 +3281,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3286,6 +3281,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
if (mem_value && struct_value == 0 && ! pcc_struct_value) if (mem_value && struct_value == 0 && ! pcc_struct_value)
{ {
rtx addr = XEXP (mem_value, 0); rtx addr = XEXP (mem_value, 0);
int partial;
nargs++; nargs++;
/* Make sure it is a reasonable operand for a move or push insn. */ /* Make sure it is a reasonable operand for a move or push insn. */
...@@ -3298,8 +3295,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3298,8 +3295,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].partial = 0; argvec[count].partial = 0;
argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1); argvec[count].reg = FUNCTION_ARG (args_so_far, Pmode, NULL_TREE, 1);
if (FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1)) partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, Pmode, NULL_TREE, 1);
abort (); gcc_assert (!partial);
locate_and_pad_parm (Pmode, NULL_TREE, locate_and_pad_parm (Pmode, NULL_TREE,
#ifdef STACK_PARMS_IN_REG_PARM_AREA #ifdef STACK_PARMS_IN_REG_PARM_AREA
...@@ -3325,9 +3322,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3325,9 +3322,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
/* We cannot convert the arg value to the mode the library wants here; /* We cannot convert the arg value to the mode the library wants here;
must do it earlier where we know the signedness of the arg. */ must do it earlier where we know the signedness of the arg. */
if (mode == BLKmode gcc_assert (mode != BLKmode
|| (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)) && (GET_MODE (val) == mode || GET_MODE (val) == VOIDmode));
abort ();
/* Make sure it is a reasonable operand for a move or push insn. */ /* Make sure it is a reasonable operand for a move or push insn. */
if (!REG_P (val) && !MEM_P (val) if (!REG_P (val) && !MEM_P (val)
...@@ -3397,8 +3393,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3397,8 +3393,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
argvec[count].partial, argvec[count].partial,
NULL_TREE, &args_size, &argvec[count].locate); NULL_TREE, &args_size, &argvec[count].locate);
if (argvec[count].locate.size.var) gcc_assert (!argvec[count].locate.size.var);
abort ();
if (argvec[count].reg == 0 || argvec[count].partial != 0 if (argvec[count].reg == 0 || argvec[count].partial != 0
|| reg_parm_stack_space > 0) || reg_parm_stack_space > 0)
...@@ -3662,8 +3657,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3662,8 +3657,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
? hard_libcall_value (outmode) : NULL_RTX); ? hard_libcall_value (outmode) : NULL_RTX);
/* Stack must be properly aligned now. */ /* Stack must be properly aligned now. */
if (stack_pointer_delta & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1)) gcc_assert (!(stack_pointer_delta
abort (); & (PREFERRED_STACK_BOUNDARY / BITS_PER_UNIT - 1)));
before_call = get_last_insn (); before_call = get_last_insn ();
...@@ -3698,8 +3693,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3698,8 +3693,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
{ {
last = PREV_INSN (last); last = PREV_INSN (last);
/* There was no CALL_INSN? */ /* There was no CALL_INSN? */
if (last == before_call) gcc_assert (last != before_call);
abort ();
} }
emit_barrier_after (last); emit_barrier_after (last);
...@@ -3975,11 +3969,10 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, ...@@ -3975,11 +3969,10 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
partial = arg->partial; partial = arg->partial;
} }
if (reg != 0 && partial == 0) /* Being passed entirely in a register. We shouldn't be called in
/* Being passed entirely in a register. We shouldn't be called in this case. */
this case. */ gcc_assert (reg == 0 || partial != 0);
abort ();
/* If this arg needs special alignment, don't load the registers /* If this arg needs special alignment, don't load the registers
here. */ here. */
if (arg->n_aligned_regs != 0) if (arg->n_aligned_regs != 0)
...@@ -4151,8 +4144,8 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags, ...@@ -4151,8 +4144,8 @@ store_one_arg (struct arg_data *arg, rtx argblock, int flags,
i = INTVAL (XEXP (XEXP (x, 0), 1)); i = INTVAL (XEXP (XEXP (x, 0), 1));
/* expand_call should ensure this. */ /* expand_call should ensure this. */
if (arg->locate.offset.var || GET_CODE (size_rtx) != CONST_INT) gcc_assert (!arg->locate.offset.var
abort (); && GET_CODE (size_rtx) == CONST_INT);
if (arg->locate.offset.constant > i) if (arg->locate.offset.constant > i)
{ {
......
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