Patchwork use gcc_checking_assert instead of ENABLE_CHECKING/gcc_assert

login
register
mail settings
Submitter Nathan Froyd
Date Oct. 21, 2010, 11:41 a.m.
Message ID <20101021114100.GE2806@nightcrawler>
Download mbox | patch
Permalink /patch/68595/
State New
Headers show

Comments

Nathan Froyd - Oct. 21, 2010, 11:41 a.m.
The patch below replaces a number of instances of:

#ifdef ENABLE_CHECKING
  gcc_assert (x)
#endif

with the simpler:

  gcc_checking_assert (x)

It's actually slightly more aggressive than that; if we had something
like:

#ifdef ENABLE_CHECKING
  for (...)
    gcc_assert (x)
#endif

I've gone ahead and replaced the gcc_assert there with ENABLE_CHECKING,
on the assumption that the compiler will be able to optimize out the
empty for loop.  I've not replaced cases like:

#ifdef ENABLE_CHECKING
  {
    thing x = func (...);

    gcc_assert (y);
  }
#endif

as the compiler might not be able to tell x is dead (func might have
side-effects).  It's certainly possible that such blocks could be
modified once func is checked for constness of parameters and so forth;
I just did the brainless replacements.

Tested on x86_64-unknown-linux-gnu.  OK to commit?

-Nathan

	* basic-block.h (single_succ_edge): Use gcc_checking_assert.
	(single_pred_edge, ei_container, ei_next, ei_prev): Likewise.
	* cfghooks.c (duplicate_block, fixup_reorder_chain): Likewise.
	* cfgrtl.c (cfg_layout_merge_blocks): Likewise.
	* cgraph.c (cgraph_add_thunk): Likewise.
	(cgraph_create_edge_1): Likewise.
	(cgraph_create_virtual_clone): Likewise.
	* ddg.c (add_cross_iteration_register_deps): Likewise.
	* df-core.c (df_analyze): Likewise.
	* dwarf2out.c (modified_type_die): Likewise.
	* emit-rtl.c (set_mem_alias_set, reorder_insns_nobb): Likewise.
	* ggc-zone.c (zone_allocate_marks): Likewise.
	* gimple-iterator.c (gsi_move_to_bb_end): Likewise.
	* gimple.c (iterative_hash_gimple_type): Likewise.
	* graphite-scop-detection.c (create_single_entry_edge): Likewise.
	(build_graphite_scops): Likewise.
	* haifa-sched.c (choose_ready): Likewise.
	* ipa.c (cgraph_remove_unreachable_nodes): Likewise.
	* lto-cgraph.c (input_cgraph_1, input_varpool_1): Likewise.
	* lto-streamer-in.c (input_gimple_stmt): Likewise.
	* passes.c (execute_todo): Likewise.
	* predict.c (propagate_freq): Likewise.
	* pretty-print.c (pp_base_format): Likewise.
	* sched-ebb.c (begin_schedule_ready): Likewise.
	* sel-sched.c (code_motion_process_successors): Likewise.
	* tree-call-cdce.c (gen_conditions_for_pow): Likewise.
	* tree-cfg-cleanup.c (tree_forwarder_block_p): Likewise.
	* tree-flow-inline.h (link_imm_use, move_use_after_head): Likewise.
	(phi_arg_index_from_use, phi_ssa_name_p): Likewise.
	* tree-into-ssa.c (insert_updated_phi_nodes_for): Likewise.
	* tree-ssa-coalesce.c (ssa_conflicts_test_p): Likewise.
	(ssa_conflicts_add): Likewise.
	* tree-ssa-copy.c (replace_exp): Likewise.
	* tree-ssa-dom.c (eliminate_redundant_computations): Likewise.
	* tree-ssa-forwprop.c (simple_gimple_switch): Likewise.
	* tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
	* tree-ssa-pre.c (bitmap_value_insert_into_set): Likewise.
	(compute_antic): Likewise.
	* tree-ssa-ter.c (free_temp_expr_table): Likewise.
	(add_to_partition_kill_list, add_dependence): Likewise.
	(process_replaceable, kill_expr, find_replaceable_exprs): Likewise.
	* tree-vrp.c (supports_overflow_infinity): Likewise.
	(make_overflow_infinity, negative_overflow_infinity): Likewise.
	(avoid_overflow_infinity, register_new_assert_for): Likewise.
	(process_assert_insertions_for): Likewise.
	* var-tracking.c (dv_is_value_p, dv_as_decl, dv_from_decl): Likewise.
	(dv_from_value, variable_union, find_loc_in_1pdv): Likewise.
	(intersect_loc_chains, variable_merge_over_cur): Likewise.
Richard Guenther - Oct. 21, 2010, 11:45 a.m.
On Thu, Oct 21, 2010 at 1:41 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
> The patch below replaces a number of instances of:
>
> #ifdef ENABLE_CHECKING
>  gcc_assert (x)
> #endif
>
> with the simpler:
>
>  gcc_checking_assert (x)
>
> It's actually slightly more aggressive than that; if we had something
> like:
>
> #ifdef ENABLE_CHECKING
>  for (...)
>    gcc_assert (x)
> #endif
>
> I've gone ahead and replaced the gcc_assert there with ENABLE_CHECKING,
> on the assumption that the compiler will be able to optimize out the
> empty for loop.  I've not replaced cases like:
>
> #ifdef ENABLE_CHECKING
>  {
>    thing x = func (...);
>
>    gcc_assert (y);
>  }
> #endif
>
> as the compiler might not be able to tell x is dead (func might have
> side-effects).  It's certainly possible that such blocks could be
> modified once func is checked for constness of parameters and so forth;
> I just did the brainless replacements.
>
> Tested on x86_64-unknown-linux-gnu.  OK to commit?

I think that #ifdefed loops are more easy to identify as enabled
only in checkin mode.  And I'd be not so sure that the iterators
themselves are optimized if the loop is empty (they have calls
to non-inline fns at least).

The rest of the changes is ok.

Thanks,
Richard.

> -Nathan
>
>        * basic-block.h (single_succ_edge): Use gcc_checking_assert.
>        (single_pred_edge, ei_container, ei_next, ei_prev): Likewise.
>        * cfghooks.c (duplicate_block, fixup_reorder_chain): Likewise.
>        * cfgrtl.c (cfg_layout_merge_blocks): Likewise.
>        * cgraph.c (cgraph_add_thunk): Likewise.
>        (cgraph_create_edge_1): Likewise.
>        (cgraph_create_virtual_clone): Likewise.
>        * ddg.c (add_cross_iteration_register_deps): Likewise.
>        * df-core.c (df_analyze): Likewise.
>        * dwarf2out.c (modified_type_die): Likewise.
>        * emit-rtl.c (set_mem_alias_set, reorder_insns_nobb): Likewise.
>        * ggc-zone.c (zone_allocate_marks): Likewise.
>        * gimple-iterator.c (gsi_move_to_bb_end): Likewise.
>        * gimple.c (iterative_hash_gimple_type): Likewise.
>        * graphite-scop-detection.c (create_single_entry_edge): Likewise.
>        (build_graphite_scops): Likewise.
>        * haifa-sched.c (choose_ready): Likewise.
>        * ipa.c (cgraph_remove_unreachable_nodes): Likewise.
>        * lto-cgraph.c (input_cgraph_1, input_varpool_1): Likewise.
>        * lto-streamer-in.c (input_gimple_stmt): Likewise.
>        * passes.c (execute_todo): Likewise.
>        * predict.c (propagate_freq): Likewise.
>        * pretty-print.c (pp_base_format): Likewise.
>        * sched-ebb.c (begin_schedule_ready): Likewise.
>        * sel-sched.c (code_motion_process_successors): Likewise.
>        * tree-call-cdce.c (gen_conditions_for_pow): Likewise.
>        * tree-cfg-cleanup.c (tree_forwarder_block_p): Likewise.
>        * tree-flow-inline.h (link_imm_use, move_use_after_head): Likewise.
>        (phi_arg_index_from_use, phi_ssa_name_p): Likewise.
>        * tree-into-ssa.c (insert_updated_phi_nodes_for): Likewise.
>        * tree-ssa-coalesce.c (ssa_conflicts_test_p): Likewise.
>        (ssa_conflicts_add): Likewise.
>        * tree-ssa-copy.c (replace_exp): Likewise.
>        * tree-ssa-dom.c (eliminate_redundant_computations): Likewise.
>        * tree-ssa-forwprop.c (simple_gimple_switch): Likewise.
>        * tree-ssa-math-opts.c (execute_cse_reciprocals): Likewise.
>        * tree-ssa-pre.c (bitmap_value_insert_into_set): Likewise.
>        (compute_antic): Likewise.
>        * tree-ssa-ter.c (free_temp_expr_table): Likewise.
>        (add_to_partition_kill_list, add_dependence): Likewise.
>        (process_replaceable, kill_expr, find_replaceable_exprs): Likewise.
>        * tree-vrp.c (supports_overflow_infinity): Likewise.
>        (make_overflow_infinity, negative_overflow_infinity): Likewise.
>        (avoid_overflow_infinity, register_new_assert_for): Likewise.
>        (process_assert_insertions_for): Likewise.
>        * var-tracking.c (dv_is_value_p, dv_as_decl, dv_from_decl): Likewise.
>        (dv_from_value, variable_union, find_loc_in_1pdv): Likewise.
>        (intersect_loc_chains, variable_merge_over_cur): Likewise.
>
> diff --git a/gcc/basic-block.h b/gcc/basic-block.h
> index e3b6e20..f175208 100644
> --- a/gcc/basic-block.h
> +++ b/gcc/basic-block.h
> @@ -560,9 +560,7 @@ single_pred_p (const_basic_block bb)
>  static inline edge
>  single_succ_edge (const_basic_block bb)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (single_succ_p (bb));
> -#endif
> +  gcc_checking_assert (single_succ_p (bb));
>   return EDGE_SUCC (bb, 0);
>  }
>
> @@ -572,9 +570,7 @@ single_succ_edge (const_basic_block bb)
>  static inline edge
>  single_pred_edge (const_basic_block bb)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (single_pred_p (bb));
> -#endif
> +  gcc_checking_assert (single_pred_p (bb));
>   return EDGE_PRED (bb, 0);
>  }
>
> @@ -606,9 +602,7 @@ typedef struct {
>  static inline VEC(edge,gc) *
>  ei_container (edge_iterator i)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (i.container);
> -#endif
> +  gcc_checking_assert (i.container);
>   return *i.container;
>  }
>
> @@ -659,9 +653,7 @@ ei_one_before_end_p (edge_iterator i)
>  static inline void
>  ei_next (edge_iterator *i)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (i->index < EDGE_COUNT (ei_container (*i)));
> -#endif
> +  gcc_checking_assert (i->index < EDGE_COUNT (ei_container (*i)));
>   i->index++;
>  }
>
> @@ -669,9 +661,7 @@ ei_next (edge_iterator *i)
>  static inline void
>  ei_prev (edge_iterator *i)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (i->index > 0);
> -#endif
> +  gcc_checking_assert (i->index > 0);
>   i->index--;
>  }
>
> diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
> index 3532b46..c6e4bc0 100644
> --- a/gcc/cfghooks.c
> +++ b/gcc/cfghooks.c
> @@ -906,9 +906,7 @@ duplicate_block (basic_block bb, edge e, basic_block after)
>   if (bb->count < new_count)
>     new_count = bb->count;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (can_duplicate_block_p (bb));
> -#endif
> +  gcc_checking_assert (can_duplicate_block_p (bb));
>
>   new_bb = cfg_hooks->duplicate_block (bb);
>   if (after)
> diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
> index 9fc05fe..8a0d35c 100644
> --- a/gcc/cfglayout.c
> +++ b/gcc/cfglayout.c
> @@ -828,10 +828,8 @@ fixup_reorder_chain (void)
>                                       : label_for_bb (e_fall->dest)), 0))
>                    {
>                      e_fall->flags &= ~EDGE_FALLTHRU;
> -#ifdef ENABLE_CHECKING
> -                     gcc_assert (could_fall_through
> -                                 (e_taken->src, e_taken->dest));
> -#endif
> +                     gcc_checking_assert (could_fall_through
> +                                          (e_taken->src, e_taken->dest));
>                      e_taken->flags |= EDGE_FALLTHRU;
>                      update_br_prob_note (bb);
>                      e = e_fall, e_fall = e_taken, e_taken = e;
> @@ -852,10 +850,8 @@ fixup_reorder_chain (void)
>                                     : label_for_bb (e_fall->dest)), 0))
>                {
>                  e_fall->flags &= ~EDGE_FALLTHRU;
> -#ifdef ENABLE_CHECKING
> -                 gcc_assert (could_fall_through
> -                             (e_taken->src, e_taken->dest));
> -#endif
> +                 gcc_checking_assert (could_fall_through
> +                                      (e_taken->src, e_taken->dest));
>                  e_taken->flags |= EDGE_FALLTHRU;
>                  update_br_prob_note (bb);
>                  continue;
> diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
> index e46050d..a158112 100644
> --- a/gcc/cfgrtl.c
> +++ b/gcc/cfgrtl.c
> @@ -2692,9 +2692,7 @@ cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
>  static void
>  cfg_layout_merge_blocks (basic_block a, basic_block b)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (cfg_layout_can_merge_blocks_p (a, b));
> -#endif
> +  gcc_checking_assert (cfg_layout_can_merge_blocks_p (a, b));
>
>   if (dump_file)
>     fprintf (dump_file, "merging block %d into block %d\n", b->index, a->index);
> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> index 342ad63..e1f47c2 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -594,10 +594,9 @@ cgraph_add_thunk (tree alias, tree decl, bool this_adjusting,
>
>   node = cgraph_same_body_alias_1 (alias, decl);
>   gcc_assert (node);
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (!virtual_offset
> -             || tree_int_cst_equal (virtual_offset, size_int (virtual_value)));
> -#endif
> +  gcc_checking_assert (!virtual_offset
> +                      || tree_int_cst_equal (virtual_offset,
> +                                             size_int (virtual_value)));
>   node->thunk.fixed_offset = fixed_offset;
>   node->thunk.this_adjusting = this_adjusting;
>   node->thunk.virtual_value = virtual_value;
> @@ -984,11 +983,9 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
>      have not been loaded yet.  */
>   if (call_stmt)
>     {
> -#ifdef ENABLE_CHECKING
> -      /* This is rather pricely check possibly trigerring construction of
> -        call stmt hashtable.  */
> -      gcc_assert (!cgraph_edge (caller, call_stmt));
> -#endif
> +      /* This is a rather expensive check possibly trigerring
> +        construction of call stmt hashtable.  */
> +      gcc_checking_assert (!cgraph_edge (caller, call_stmt));
>
>       gcc_assert (is_gimple_call (call_stmt));
>     }
> @@ -2258,10 +2255,8 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
>   size_t i;
>   struct ipa_replace_map *map;
>
> -#ifdef ENABLE_CHECKING
>   if (!flag_wpa)
> -    gcc_assert  (tree_versionable_function_p (old_decl));
> -#endif
> +    gcc_checking_assert  (tree_versionable_function_p (old_decl));
>
>   /* Make a new FUNCTION_DECL tree node */
>   if (!args_to_skip)
> diff --git a/gcc/ddg.c b/gcc/ddg.c
> index 88aaf9b..d7b093b 100644
> --- a/gcc/ddg.c
> +++ b/gcc/ddg.c
> @@ -262,10 +262,9 @@ add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
>   gcc_assert (last_def_node);
>   gcc_assert (first_def);
>
> -#ifdef ENABLE_CHECKING
>   if (DF_REF_ID (last_def) != DF_REF_ID (first_def))
> -    gcc_assert (!bitmap_bit_p (&bb_info->gen, DF_REF_ID (first_def)));
> -#endif
> +    gcc_checking_assert (!bitmap_bit_p (&bb_info->gen,
> +                                       DF_REF_ID (first_def)));
>
>   /* Create inter-loop true dependences and anti dependences.  */
>   for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next)
> diff --git a/gcc/df-core.c b/gcc/df-core.c
> index 7c49ccd..8d40d2f 100644
> --- a/gcc/df-core.c
> +++ b/gcc/df-core.c
> @@ -1211,12 +1211,11 @@ df_analyze (void)
>   for (i = 0; i < df->n_blocks; i++)
>     bitmap_set_bit (current_all_blocks, df->postorder[i]);
>
> -#ifdef ENABLE_CHECKING
>   /* Verify that POSTORDER_INVERTED only contains blocks reachable from
>      the ENTRY block.  */
>   for (i = 0; i < df->n_blocks_inverted; i++)
> -    gcc_assert (bitmap_bit_p (current_all_blocks, df->postorder_inverted[i]));
> -#endif
> +    gcc_checking_assert (bitmap_bit_p (current_all_blocks,
> +                                      df->postorder_inverted[i]));
>
>   /* Make sure that we have pruned any unreachable blocks from these
>      sets.  */
> diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
> index d19a5cd..33a7b56 100644
> --- a/gcc/dwarf2out.c
> +++ b/gcc/dwarf2out.c
> @@ -12715,15 +12715,14 @@ modified_type_die (tree type, int is_const_type, int is_volatile_type,
>       && TYPE_NAME (qualified_type)
>       && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL)
>     {
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (TREE_CODE (TREE_TYPE (TYPE_NAME (qualified_type)))
> -                 == INTEGER_TYPE
> -                 && TYPE_PRECISION (TREE_TYPE (TYPE_NAME (qualified_type)))
> -                    == TYPE_PRECISION (qualified_type)
> -                 && TYPE_UNSIGNED (TREE_TYPE (TYPE_NAME (qualified_type)))
> -                    == TYPE_UNSIGNED (qualified_type));
> -#endif
> -      qualified_type = TREE_TYPE (TYPE_NAME (qualified_type));
> +      tree t = TREE_TYPE (TYPE_NAME (qualified_type));
> +
> +      gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE
> +                          && TYPE_PRECISION (t)
> +                          == TYPE_PRECISION (qualified_type)
> +                          && TYPE_UNSIGNED (t)
> +                          == TYPE_UNSIGNED (qualified_type));
> +      qualified_type = t;
>     }
>
>   /* If we do, then we can just use its DIE, if it exists.  */
> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
> index 01dd70a..30c1f37 100644
> --- a/gcc/emit-rtl.c
> +++ b/gcc/emit-rtl.c
> @@ -1839,10 +1839,8 @@ set_mem_attributes (rtx ref, tree t, int objectp)
>  void
>  set_mem_alias_set (rtx mem, alias_set_type set)
>  {
> -#ifdef ENABLE_CHECKING
>   /* If the new and old alias sets don't conflict, something is wrong.  */
> -  gcc_assert (alias_sets_conflict_p (set, MEM_ALIAS_SET (mem)));
> -#endif
> +  gcc_checking_assert (alias_sets_conflict_p (set, MEM_ALIAS_SET (mem)));
>
>   MEM_ATTRS (mem) = get_mem_attrs (set, MEM_EXPR (mem), MEM_OFFSET (mem),
>                                   MEM_SIZE (mem), MEM_ALIGN (mem),
> @@ -3980,12 +3978,10 @@ delete_insns_since (rtx from)
>  void
>  reorder_insns_nobb (rtx from, rtx to, rtx after)
>  {
> -#ifdef ENABLE_CHECKING
>   rtx x;
>   for (x = from; x != to; x = NEXT_INSN (x))
> -    gcc_assert (after != x);
> -  gcc_assert (after != to);
> -#endif
> +    gcc_checking_assert (after != x);
> +  gcc_checking_assert (after != to);
>
>   /* Splice this bunch out of where it is now.  */
>   if (PREV_INSN (from))
> diff --git a/gcc/ggc-zone.c b/gcc/ggc-zone.c
> index 4338bb6..7d8420a 100644
> --- a/gcc/ggc-zone.c
> +++ b/gcc/ggc-zone.c
> @@ -802,9 +802,7 @@ zone_allocate_marks (void)
>          n++;
>  #endif
>        }
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (n == zone->n_small_pages);
> -#endif
> +      gcc_checking_assert (n == zone->n_small_pages);
>     }
>
>   /* We don't collect the PCH zone, but we do have to mark it
> diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
> index 064b7fe..d654f2f 100644
> --- a/gcc/gimple-iterator.c
> +++ b/gcc/gimple-iterator.c
> @@ -597,9 +597,7 @@ void
>  gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
>  {
>   gimple_stmt_iterator last = gsi_last_bb (bb);
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (gsi_bb (last) == bb);
> -#endif
> +  gcc_checking_assert (gsi_bb (last) == bb);
>
>   /* Have to check gsi_end_p because it could be an empty block.  */
>   if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last)))
> diff --git a/gcc/gimple.c b/gcc/gimple.c
> index fca7803..6547567 100644
> --- a/gcc/gimple.c
> +++ b/gcc/gimple.c
> @@ -3999,10 +3999,8 @@ iterative_hash_gimple_type (tree type, hashval_t val,
>   void **slot;
>   struct sccs *state;
>
> -#ifdef ENABLE_CHECKING
>   /* Not visited during this DFS walk.  */
> -  gcc_assert (!pointer_map_contains (sccstate, type));
> -#endif
> +  gcc_checking_assert (!pointer_map_contains (sccstate, type));
>   state = XOBNEW (sccstate_obstack, struct sccs);
>   *pointer_map_insert (sccstate, type) = state;
>
> diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
> index 5fae5aa..6d220b9 100644
> --- a/gcc/graphite-scop-detection.c
> +++ b/gcc/graphite-scop-detection.c
> @@ -899,9 +899,7 @@ create_single_entry_edge (sd_region *region)
>        single edge pointing from outside into the loop.  */
>     gcc_unreachable ();
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (find_single_entry_edge (region));
> -#endif
> +  gcc_checking_assert (find_single_entry_edge (region));
>  }
>
>  /* Check if the sd_region, mentioned in EDGE, has no exit bb.  */
> @@ -967,9 +965,7 @@ create_single_exit_edge (sd_region *region)
>     if (e->aux)
>       ((sd_region *) e->aux)->exit = forwarder->dest;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (find_single_exit_edge (region));
> -#endif
> +  gcc_checking_assert (find_single_exit_edge (region));
>  }
>
>  /* Unmark the exit edges of all REGIONS.
> @@ -1058,16 +1054,14 @@ build_graphite_scops (VEC (sd_region, heap) *regions,
>       VEC_safe_push (scop_p, heap, *scops, scop);
>
>       /* Are there overlapping SCoPs?  */
> -#ifdef ENABLE_CHECKING
>        {
>          int j;
>          sd_region *s2;
>
>          FOR_EACH_VEC_ELT (sd_region, regions, j, s2)
>            if (s != s2)
> -             gcc_assert (!bb_in_sd_region (s->entry, s2));
> +             gcc_checking_assert (!bb_in_sd_region (s->entry, s2));
>        }
> -#endif
>     }
>  }
>
> diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
> index 015f8b9..40f125d 100644
> --- a/gcc/haifa-sched.c
> +++ b/gcc/haifa-sched.c
> @@ -2727,14 +2727,12 @@ choose_ready (struct ready_list *ready, rtx *insn_ptr)
>          {
>            insn = ready_element (ready, i);
>
> -#ifdef ENABLE_CHECKING
>            /* If this insn is recognizable we should have already
>               recognized it earlier.
>               ??? Not very clear where this is supposed to be done.
>               See dep_cost_1.  */
> -           gcc_assert (INSN_CODE (insn) >= 0
> -                       || recog_memoized (insn) < 0);
> -#endif
> +           gcc_checking_assert (INSN_CODE (insn) >= 0
> +                                || recog_memoized (insn) < 0);
>
>            ready_try [i]
>              = (/* INSN_CODE check can be omitted here as it is also done later
> diff --git a/gcc/ipa.c b/gcc/ipa.c
> index 7db27f3..2eda12a 100644
> --- a/gcc/ipa.c
> +++ b/gcc/ipa.c
> @@ -230,12 +230,10 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
>  #endif
>   if (file)
>     fprintf (file, "\nReclaiming functions:");
> -#ifdef ENABLE_CHECKING
>   for (node = cgraph_nodes; node; node = node->next)
> -    gcc_assert (!node->aux);
> +    gcc_checking_assert (!node->aux);
>   for (vnode = varpool_nodes; vnode; vnode = vnode->next)
> -    gcc_assert (!vnode->aux);
> -#endif
> +    gcc_checking_assert (!vnode->aux);
>   varpool_reset_queue ();
>   for (node = cgraph_nodes; node; node = node->next)
>     if ((!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
> @@ -782,7 +780,6 @@ function_and_variable_visibility (bool whole_program)
>         and simplifies later passes.  */
>       if (node->same_comdat_group && DECL_EXTERNAL (node->decl))
>        {
> -#ifdef ENABLE_CHECKING
>          struct cgraph_node *n;
>
>          for (n = node->same_comdat_group;
> @@ -790,8 +787,8 @@ function_and_variable_visibility (bool whole_program)
>               n = n->same_comdat_group)
>              /* If at least one of same comdat group functions is external,
>                 all of them have to be, otherwise it is a front-end bug.  */
> -             gcc_assert (DECL_EXTERNAL (n->decl));
> -#endif
> +             gcc_checking_assert (DECL_EXTERNAL (n->decl));
> +
>          dissolve_same_comdat_group_list (node);
>        }
>       gcc_assert ((!DECL_WEAK (node->decl) && !DECL_COMDAT (node->decl))
> diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
> index 85a7c40..da63729 100644
> --- a/gcc/lto-cgraph.c
> +++ b/gcc/lto-cgraph.c
> @@ -1309,10 +1309,8 @@ input_cgraph_1 (struct lto_file_decl_data *file_data,
>       len = lto_input_uleb128 (ib);
>     }
>   /* AUX pointers should be all non-zero for nodes read from the stream.  */
> -#ifdef ENABLE_CHECKING
>   FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
> -    gcc_assert (node->aux);
> -#endif
> +    gcc_checking_assert (node->aux);
>   FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
>     {
>       int ref = (int) (intptr_t) node->global.inlined_to;
> @@ -1359,10 +1357,8 @@ input_varpool_1 (struct lto_file_decl_data *file_data,
>                     input_varpool_node (file_data, ib));
>       len--;
>     }
> -#ifdef ENABLE_CHECKING
>   FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
> -    gcc_assert (!node->aux);
> -#endif
> +    gcc_checking_assert (!node->aux);
>   FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
>     {
>       int ref = (int) (intptr_t) node->same_comdat_group;
> diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
> index 72ac6ec..50352e8 100644
> --- a/gcc/lto-streamer-in.c
> +++ b/gcc/lto-streamer-in.c
> @@ -973,9 +973,7 @@ input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
>                     to unify some types and thus not find a proper
>                     field-decl here.  So only assert here if checking
>                     is enabled.  */
> -#ifdef ENABLE_CHECKING
> -                 gcc_assert (tem != NULL_TREE);
> -#endif
> +                 gcc_checking_assert (tem != NULL_TREE);
>                  if (tem != NULL_TREE)
>                    TREE_OPERAND (op, 1) = tem;
>                }
> diff --git a/gcc/passes.c b/gcc/passes.c
> index 1308ce9..1ee3400 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -1310,9 +1310,7 @@ execute_todo (unsigned int flags)
>  static void
>  verify_interpass_invariants (void)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (!fold_deferring_overflow_warnings_p ());
> -#endif
> +  gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
>  }
>
>  /* Clear the last verified flag.  */
> diff --git a/gcc/predict.c b/gcc/predict.c
> index eb91b87..40d147a 100644
> --- a/gcc/predict.c
> +++ b/gcc/predict.c
> @@ -1915,11 +1915,9 @@ propagate_freq (basic_block head, bitmap tovisit)
>       /* Compute frequency of basic block.  */
>       if (bb != head)
>        {
> -#ifdef ENABLE_CHECKING
>          FOR_EACH_EDGE (e, ei, bb->preds)
> -           gcc_assert (!bitmap_bit_p (tovisit, e->src->index)
> -                       || (e->flags & EDGE_DFS_BACK));
> -#endif
> +           gcc_checking_assert (!bitmap_bit_p (tovisit, e->src->index)
> +                                || (e->flags & EDGE_DFS_BACK));
>
>          FOR_EACH_EDGE (e, ei, bb->preds)
>            if (EDGE_INFO (e)->back_edge)
> diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
> index 8aa9978..20c144d 100644
> --- a/gcc/pretty-print.c
> +++ b/gcc/pretty-print.c
> @@ -518,10 +518,8 @@ pp_base_format (pretty_printer *pp, text_info *text)
>       *formatters[argno] = XOBFINISH (&buffer->chunk_obstack, const char *);
>     }
>
> -#ifdef ENABLE_CHECKING
>   for (; argno < PP_NL_ARGMAX; argno++)
> -    gcc_assert (!formatters[argno]);
> -#endif
> +    gcc_checking_assert (!formatters[argno]);
>
>   /* Revert to normal obstack and wrapping mode.  */
>   buffer->obstack = &buffer->formatted_obstack;
> diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
> index 8e69215..8090898 100644
> --- a/gcc/sched-ebb.c
> +++ b/gcc/sched-ebb.c
> @@ -147,24 +147,22 @@ begin_schedule_ready (rtx insn, rtx last)
>
>       e = find_fallthru_edge (last_bb->succs);
>
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (!e || !(e->flags & EDGE_COMPLEX));
> +      gcc_checking_assert (!e || !(e->flags & EDGE_COMPLEX));
>
> -      gcc_assert (BLOCK_FOR_INSN (insn) == last_bb
> -                 && !IS_SPECULATION_CHECK_P (insn)
> -                 && BB_HEAD (last_bb) != insn
> -                 && BB_END (last_bb) == insn);
> +      gcc_checking_assert (BLOCK_FOR_INSN (insn) == last_bb
> +                          && !IS_SPECULATION_CHECK_P (insn)
> +                          && BB_HEAD (last_bb) != insn
> +                          && BB_END (last_bb) == insn);
>
>       {
>        rtx x;
>
>        x = NEXT_INSN (insn);
>        if (e)
> -         gcc_assert (NOTE_P (x) || LABEL_P (x));
> +         gcc_checking_assert (NOTE_P (x) || LABEL_P (x));
>        else
> -         gcc_assert (BARRIER_P (x));
> +         gcc_checking_assert (BARRIER_P (x));
>       }
> -#endif
>
>       if (e)
>        {
> diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
> index d93ebaa..378e561 100644
> --- a/gcc/sel-sched.c
> +++ b/gcc/sel-sched.c
> @@ -6360,7 +6360,6 @@ code_motion_process_successors (insn_t insn, av_set_t orig_ops,
>         goto rescan;
>     }
>
> -#ifdef ENABLE_CHECKING
>   /* Here, RES==1 if original expr was found at least for one of the
>      successors.  After the loop, RES may happen to have zero value
>      only if at some point the expr searched is present in av_set, but is
> @@ -6368,12 +6367,11 @@ code_motion_process_successors (insn_t insn, av_set_t orig_ops,
>      The exception is when the original operation is blocked by
>      bookkeeping generated for another fence or for another path in current
>      move_op.  */
> -  gcc_assert (res == 1
> -              || (res == 0
> -                  && av_set_could_be_blocked_by_bookkeeping_p (orig_ops,
> -                                                              static_params))
> -              || res == -1);
> -#endif
> +  gcc_checking_assert (res == 1
> +                      || (res == 0
> +                          && av_set_could_be_blocked_by_bookkeeping_p (orig_ops,
> +                                                                       static_params))
> +                      || res == -1);
>
>   /* Merge data, clean up, etc.  */
>   if (res != -1 && code_motion_path_driver_info->after_merge_succs)
> diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
> index 7f0a3e2..25476e6 100644
> --- a/gcc/tree-call-cdce.c
> +++ b/gcc/tree-call-cdce.c
> @@ -541,9 +541,7 @@ gen_conditions_for_pow (gimple pow_call, VEC (gimple, heap) *conds,
>   tree base, expn;
>   enum tree_code bc;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (check_pow (pow_call));
> -#endif
> +  gcc_checking_assert (check_pow (pow_call));
>
>   *nconds = 0;
>
> diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
> index 3c1ca2d..139d8f9 100644
> --- a/gcc/tree-cfgcleanup.c
> +++ b/gcc/tree-cfgcleanup.c
> @@ -279,9 +279,7 @@ tree_forwarder_block_p (basic_block bb, bool phi_wanted)
>       || (single_succ_edge (bb)->flags & EDGE_ABNORMAL))
>     return false;
>
> -#if ENABLE_CHECKING
> -  gcc_assert (bb != ENTRY_BLOCK_PTR);
> -#endif
> +  gcc_checking_assert (bb != ENTRY_BLOCK_PTR);
>
>   locus = single_succ_edge (bb)->goto_locus;
>
> diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
> index 7103d23..1a62cdd 100644
> --- a/gcc/tree-flow-inline.h
> +++ b/gcc/tree-flow-inline.h
> @@ -230,10 +230,8 @@ link_imm_use (ssa_use_operand_t *linknode, tree def)
>   else
>     {
>       root = &(SSA_NAME_IMM_USE_NODE (def));
> -#ifdef ENABLE_CHECKING
>       if (linknode->use)
>         gcc_checking_assert (*(linknode->use) == def);
> -#endif
>       link_imm_use_to_list (linknode, root);
>     }
>  }
> @@ -556,13 +554,11 @@ phi_arg_index_from_use (use_operand_p use)
>   root = gimple_phi_arg (phi, 0);
>   index = element - root;
>
> -#ifdef ENABLE_CHECKING
>   /* Make sure the calculation doesn't have any leftover bytes.  If it does,
>      then imm_use is likely not the first element in phi_arg_d.  */
> -  gcc_assert ((((char *)element - (char *)root)
> -              % sizeof (struct phi_arg_d)) == 0
> -             && index < gimple_phi_capacity (phi));
> -#endif
> +  gcc_checking_assert ((((char *)element - (char *)root)
> +                       % sizeof (struct phi_arg_d)) == 0
> +                      && index < gimple_phi_capacity (phi));
>
>  return index;
>  }
> @@ -613,9 +609,7 @@ phi_ssa_name_p (const_tree t)
>  {
>   if (TREE_CODE (t) == SSA_NAME)
>     return true;
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (is_gimple_min_invariant (t));
> -#endif
> +  gcc_checking_assert (is_gimple_min_invariant (t));
>   return false;
>  }
>
> @@ -975,9 +969,7 @@ static inline use_operand_p
>  move_use_after_head (use_operand_p use_p, use_operand_p head,
>                      use_operand_p last_p)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
> -#endif
> +  gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
>   /* Skip head when we find it.  */
>   if (use_p != head)
>     {
> diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
> index cbd629c..8237dd2 100644
> --- a/gcc/tree-into-ssa.c
> +++ b/gcc/tree-into-ssa.c
> @@ -3009,12 +3009,10 @@ insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
>   bitmap_iterator bi;
>   unsigned i;
>
> -#if defined ENABLE_CHECKING
>   if (TREE_CODE (var) == SSA_NAME)
> -    gcc_assert (is_old_name (var));
> +    gcc_checking_assert (is_old_name (var));
>   else
> -    gcc_assert (symbol_marked_for_renaming (var));
> -#endif
> +    gcc_checking_assert (symbol_marked_for_renaming (var));
>
>   /* Get all the definition sites for VAR.  */
>   db = find_def_blocks_for (var);
> diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
> index be44d56..7615612 100644
> --- a/gcc/tree-ssa-coalesce.c
> +++ b/gcc/tree-ssa-coalesce.c
> @@ -547,11 +547,9 @@ ssa_conflicts_test_p (ssa_conflicts_p ptr, unsigned x, unsigned y)
>  {
>   bitmap b;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (x < ptr->size);
> -  gcc_assert (y < ptr->size);
> -  gcc_assert (x != y);
> -#endif
> +  gcc_checking_assert (x < ptr->size);
> +  gcc_checking_assert (y < ptr->size);
> +  gcc_checking_assert (x != y);
>
>   b = ptr->conflicts[x];
>   if (b)
> @@ -579,11 +577,9 @@ ssa_conflicts_add_one (ssa_conflicts_p ptr, unsigned x, unsigned y)
>  static inline void
>  ssa_conflicts_add (ssa_conflicts_p ptr, unsigned x, unsigned y)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (x < ptr->size);
> -  gcc_assert (y < ptr->size);
> -  gcc_assert (x != y);
> -#endif
> +  gcc_checking_assert (x < ptr->size);
> +  gcc_checking_assert (y < ptr->size);
> +  gcc_checking_assert (x != y);
>   ssa_conflicts_add_one (ptr, x, y);
>   ssa_conflicts_add_one (ptr, y, x);
>  }
> diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
> index c82943c..a92b63b 100644
> --- a/gcc/tree-ssa-copy.c
> +++ b/gcc/tree-ssa-copy.c
> @@ -211,12 +211,10 @@ replace_exp (use_operand_p op_p, tree val)
>  void
>  propagate_tree_value (tree *op_p, tree val)
>  {
> -#if defined ENABLE_CHECKING
> -  gcc_assert (!(TREE_CODE (val) == SSA_NAME
> -                && *op_p
> -               && TREE_CODE (*op_p) == SSA_NAME
> -               && !may_propagate_copy (*op_p, val)));
> -#endif
> +  gcc_checking_assert (!(TREE_CODE (val) == SSA_NAME
> +                        && *op_p
> +                        && TREE_CODE (*op_p) == SSA_NAME
> +                        && !may_propagate_copy (*op_p, val)));
>
>   if (TREE_CODE (val) == SSA_NAME)
>     *op_p = val;
> diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
> index 54a35af..bab6ced 100644
> --- a/gcc/tree-ssa-dom.c
> +++ b/gcc/tree-ssa-dom.c
> @@ -1852,10 +1852,8 @@ eliminate_redundant_computations (gimple_stmt_iterator* gsi)
>            || useless_type_conversion_p (expr_type, TREE_TYPE (cached_lhs))))
>       || may_propagate_copy_into_stmt (stmt, cached_lhs))
>   {
> -#if defined ENABLE_CHECKING
> -      gcc_assert (TREE_CODE (cached_lhs) == SSA_NAME
> -                 || is_gimple_min_invariant (cached_lhs));
> -#endif
> +      gcc_checking_assert (TREE_CODE (cached_lhs) == SSA_NAME
> +                          || is_gimple_min_invariant (cached_lhs));
>
>       if (dump_file && (dump_flags & TDF_DETAILS))
>        {
> diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
> index a68755e..f4808e7 100644
> --- a/gcc/tree-ssa-forwprop.c
> +++ b/gcc/tree-ssa-forwprop.c
> @@ -1286,10 +1286,8 @@ simplify_gimple_switch (gimple stmt)
>
>              def = gimple_assign_rhs1 (def_stmt);
>
> -#ifdef ENABLE_CHECKING
>              /* ??? Why was Jeff testing this?  We are gimple...  */
> -             gcc_assert (is_gimple_val (def));
> -#endif
> +             gcc_checking_assert (is_gimple_val (def));
>
>              to = TREE_TYPE (cond);
>              ti = TREE_TYPE (def);
> diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
> index a814f6f..0321a4b 100644
> --- a/gcc/tree-ssa-math-opts.c
> +++ b/gcc/tree-ssa-math-opts.c
> @@ -469,10 +469,8 @@ execute_cse_reciprocals (void)
>   calculate_dominance_info (CDI_DOMINATORS);
>   calculate_dominance_info (CDI_POST_DOMINATORS);
>
> -#ifdef ENABLE_CHECKING
>   FOR_EACH_BB (bb)
> -    gcc_assert (!bb->aux);
> -#endif
> +    gcc_checking_assert (!bb->aux);
>
>   for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
>     if (gimple_default_def (cfun, arg)
> diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
> index d4d108d..8f91bd6 100644
> --- a/gcc/tree-ssa-pre.c
> +++ b/gcc/tree-ssa-pre.c
> @@ -895,9 +895,7 @@ bitmap_value_insert_into_set (bitmap_set_t set, pre_expr expr)
>  {
>   unsigned int val = get_expr_value_id (expr);
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (expr->id == get_or_alloc_expression_id (expr));
> -#endif
> +  gcc_checking_assert (expr->id == get_or_alloc_expression_id (expr));
>
>   /* Constant values are always considered to be part of the set.  */
>   if (value_id_constant_p (val))
> @@ -2608,10 +2606,8 @@ compute_antic (void)
>                                                      block->index));
>            }
>        }
> -#ifdef ENABLE_CHECKING
>       /* Theoretically possible, but *highly* unlikely.  */
> -      gcc_assert (num_iterations < 500);
> -#endif
> +      gcc_checking_assert (num_iterations < 500);
>     }
>
>   statistics_histogram_event (cfun, "compute_antic iterations",
> @@ -2640,10 +2636,8 @@ compute_antic (void)
>                                                            block->index));
>                }
>            }
> -#ifdef ENABLE_CHECKING
>          /* Theoretically possible, but *highly* unlikely.  */
> -         gcc_assert (num_iterations < 500);
> -#endif
> +         gcc_checking_assert (num_iterations < 500);
>        }
>       statistics_histogram_event (cfun, "compute_partial_antic iterations",
>                                  num_iterations);
> diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
> index 0fb8028..ca67ec0 100644
> --- a/gcc/tree-ssa-ter.c
> +++ b/gcc/tree-ssa-ter.c
> @@ -223,17 +223,14 @@ static bitmap
>  free_temp_expr_table (temp_expr_table_p t)
>  {
>   bitmap ret = NULL;
> -
> -#ifdef ENABLE_CHECKING
>   unsigned x;
>   for (x = 0; x <= num_var_partitions (t->map); x++)
> -    gcc_assert (!t->kill_list[x]);
> +    gcc_checking_assert (!t->kill_list[x]);
>   for (x = 0; x < num_ssa_names; x++)
>     {
> -      gcc_assert (t->expr_decl_uids[x] == NULL);
> -      gcc_assert (t->partition_dependencies[x] == NULL);
> +      gcc_checking_assert (t->expr_decl_uids[x] == NULL);
> +      gcc_checking_assert (t->partition_dependencies[x] == NULL);
>     }
> -#endif
>
>   BITMAP_FREE (t->partition_in_use);
>   BITMAP_FREE (t->new_replaceable_dependencies);
> @@ -296,9 +293,7 @@ add_to_partition_kill_list (temp_expr_table_p tab, int p, int ver)
>  static inline void
>  remove_from_partition_kill_list (temp_expr_table_p tab, int p, int version)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (tab->kill_list[p]);
> -#endif
> +  gcc_checking_assert (tab->kill_list[p]);
>   bitmap_clear_bit (tab->kill_list[p], version);
>   if (bitmap_empty_p (tab->kill_list[p]))
>     {
> @@ -345,10 +340,8 @@ add_dependence (temp_expr_table_p tab, int version, tree var)
>   else
>     {
>       i = var_to_partition (tab->map, var);
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (i != NO_PARTITION);
> -      gcc_assert (tab->num_in_part[i] != 0);
> -#endif
> +      gcc_checking_assert (i != NO_PARTITION);
> +      gcc_checking_assert (tab->num_in_part[i] != 0);
>       /* Only dependencies on ssa_names which are coalesced with something need
>          to be tracked.  Partitions with containing only a single SSA_NAME
>         *cannot* have their value changed.  */
> @@ -479,9 +472,7 @@ process_replaceable (temp_expr_table_p tab, gimple stmt, int call_cnt)
>   ssa_op_iter iter;
>   bitmap def_vars, use_vars;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (is_replaceable_p (stmt));
> -#endif
> +  gcc_checking_assert (is_replaceable_p (stmt));
>
>   def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
>   version = SSA_NAME_VERSION (def);
> @@ -534,9 +525,7 @@ kill_expr (temp_expr_table_p tab, int partition)
>       finished_with_expr (tab, version, true);
>     }
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (!tab->kill_list[partition]);
> -#endif
> +  gcc_checking_assert (!tab->kill_list[partition]);
>  }
>
>
> @@ -704,9 +693,7 @@ find_replaceable_exprs (var_map map)
>   FOR_EACH_BB (bb)
>     {
>       find_replaceable_in_bb (table, bb);
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (bitmap_empty_p (table->partition_in_use));
> -#endif
> +      gcc_checking_assert (bitmap_empty_p (table->partition_in_use));
>     }
>
>   ret = free_temp_expr_table (table);
> diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
> index c005c53..8ab986e 100644
> --- a/gcc/tree-vrp.c
> +++ b/gcc/tree-vrp.c
> @@ -243,9 +243,7 @@ supports_overflow_infinity (const_tree type)
>  static inline tree
>  make_overflow_infinity (tree val)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (val != NULL_TREE && CONSTANT_CLASS_P (val));
> -#endif
> +  gcc_checking_assert (val != NULL_TREE && CONSTANT_CLASS_P (val));
>   val = copy_node (val);
>   TREE_OVERFLOW (val) = 1;
>   return val;
> @@ -256,9 +254,7 @@ make_overflow_infinity (tree val)
>  static inline tree
>  negative_overflow_infinity (tree type)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (supports_overflow_infinity (type));
> -#endif
> +  gcc_checking_assert (supports_overflow_infinity (type));
>   return make_overflow_infinity (vrp_val_min (type));
>  }
>
> @@ -267,9 +263,7 @@ negative_overflow_infinity (tree type)
>  static inline tree
>  positive_overflow_infinity (tree type)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (supports_overflow_infinity (type));
> -#endif
> +  gcc_checking_assert (supports_overflow_infinity (type));
>   return make_overflow_infinity (vrp_val_max (type));
>  }
>
> @@ -332,9 +326,7 @@ avoid_overflow_infinity (tree val)
>     return vrp_val_max (TREE_TYPE (val));
>   else
>     {
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (vrp_val_is_min (val));
> -#endif
> +      gcc_checking_assert (vrp_val_is_min (val));
>       return vrp_val_min (TREE_TYPE (val));
>     }
>  }
> @@ -4131,13 +4123,11 @@ register_new_assert_for (tree name, tree expr,
>   assert_locus_t n, loc, last_loc;
>   basic_block dest_bb;
>
> -#if defined ENABLE_CHECKING
> -  gcc_assert (bb == NULL || e == NULL);
> +  gcc_checking_assert (bb == NULL || e == NULL);
>
>   if (e == NULL)
> -    gcc_assert (gimple_code (gsi_stmt (si)) != GIMPLE_COND
> -               && gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH);
> -#endif
> +    gcc_checking_assert (gimple_code (gsi_stmt (si)) != GIMPLE_COND
> +                        && gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH);
>
>   /* Never build an assert comparing against an integer constant with
>      TREE_OVERFLOW set.  This confuses our undefined overflow warning
> @@ -5059,10 +5049,9 @@ process_assert_insertions_for (tree name, assert_locus_t loc)
>     {
>       /* We have been asked to insert the assertion on an edge.  This
>         is used only by COND_EXPR and SWITCH_EXPR assertions.  */
> -#if defined ENABLE_CHECKING
> -      gcc_assert (gimple_code (gsi_stmt (loc->si)) == GIMPLE_COND
> -         || gimple_code (gsi_stmt (loc->si)) == GIMPLE_SWITCH);
> -#endif
> +      gcc_checking_assert (gimple_code (gsi_stmt (loc->si)) == GIMPLE_COND
> +                          || (gimple_code (gsi_stmt (loc->si))
> +                              == GIMPLE_SWITCH));
>
>       gsi_insert_on_edge (loc->e, assert_stmt);
>       return true;
> diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
> index c74ef7c..c3d5077 100644
> --- a/gcc/var-tracking.c
> +++ b/gcc/var-tracking.c
> @@ -1075,9 +1075,7 @@ dv_is_value_p (decl_or_value dv)
>  static inline tree
>  dv_as_decl (decl_or_value dv)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (dv_is_decl_p (dv));
> -#endif
> +  gcc_checking_assert (dv_is_decl_p (dv));
>   return (tree) dv;
>  }
>
> @@ -1085,9 +1083,7 @@ dv_as_decl (decl_or_value dv)
>  static inline rtx
>  dv_as_value (decl_or_value dv)
>  {
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (dv_is_value_p (dv));
> -#endif
> +  gcc_checking_assert (dv_is_value_p (dv));
>   return (rtx)dv;
>  }
>
> @@ -1136,9 +1132,7 @@ dv_from_decl (tree decl)
>  {
>   decl_or_value dv;
>   dv = decl;
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (dv_is_decl_p (dv));
> -#endif
> +  gcc_checking_assert (dv_is_decl_p (dv));
>   return dv;
>  }
>
> @@ -1148,9 +1142,7 @@ dv_from_value (rtx value)
>  {
>   decl_or_value dv;
>   dv = value;
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (dv_is_value_p (dv));
> -#endif
> +  gcc_checking_assert (dv_is_value_p (dv));
>   return dv;
>  }
>
> @@ -2182,10 +2174,8 @@ variable_union (variable src, dataflow_set *set)
>              nnode->next = dnode;
>              dnode = nnode;
>            }
> -#ifdef ENABLE_CHECKING
>          else if (r == 0)
> -           gcc_assert (rtx_equal_p (dnode->loc, snode->loc));
> -#endif
> +           gcc_checking_assert (rtx_equal_p (dnode->loc, snode->loc));
>
>          if (r >= 0)
>            snode = snode->next;
> @@ -2549,17 +2539,13 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
>   if (!var)
>     return NULL;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (dv_onepart_p (var->dv));
> -#endif
> +  gcc_checking_assert (dv_onepart_p (var->dv));
>
>   if (!var->n_var_parts)
>     return NULL;
>
> -#ifdef ENABLE_CHECKING
> -  gcc_assert (var->var_part[0].offset == 0);
> -  gcc_assert (loc != dv_as_opaque (var->dv));
> -#endif
> +  gcc_checking_assert (var->var_part[0].offset == 0);
> +  gcc_checking_assert (loc != dv_as_opaque (var->dv));
>
>   loc_code = GET_CODE (loc);
>   for (node = var->var_part[0].loc_chain; node; node = node->next)
> @@ -2591,20 +2577,16 @@ find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
>          while (node->next && GET_CODE (node->next->loc) == VALUE)
>            {
>              node = node->next;
> -#ifdef ENABLE_CHECKING
> -             gcc_assert (!canon_value_cmp (node->loc,
> -                                           dv_as_value (var->dv)));
> -#endif
> +             gcc_checking_assert (!canon_value_cmp (node->loc,
> +                                                    dv_as_value (var->dv)));
>              if (loc == node->loc)
>                return node;
>            }
>          continue;
>        }
>
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (node == var->var_part[0].loc_chain);
> -      gcc_assert (!node->next);
> -#endif
> +      gcc_checking_assert (node == var->var_part[0].loc_chain);
> +      gcc_checking_assert (!node->next);
>
>       dv = dv_from_value (node->loc);
>       rvar = (variable) htab_find_with_hash (vars, dv, dv_htab_hash (dv));
> @@ -2672,15 +2654,11 @@ intersect_loc_chains (rtx val, location_chain *dest, struct dfset_merge *dsm,
>     {
>       location_chain s2node;
>
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (dv_onepart_p (s2var->dv));
> -#endif
> +      gcc_checking_assert (dv_onepart_p (s2var->dv));
>
>       if (s2var->n_var_parts)
>        {
> -#ifdef ENABLE_CHECKING
> -         gcc_assert (s2var->var_part[0].offset == 0);
> -#endif
> +         gcc_checking_assert (s2var->var_part[0].offset == 0);
>          s2node = s2var->var_part[0].loc_chain;
>
>          for (; s1node && s2node;
> @@ -2829,10 +2807,8 @@ loc_cmp (rtx x, rtx y)
>       if (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
>          < DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)))
>        return -1;
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
> -                 > DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)));
> -#endif
> +      gcc_checking_assert (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
> +                          > DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)));
>       return 1;
>     }
>
> @@ -3592,10 +3568,9 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm)
>       dstslot = shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash);
>       gcc_assert (*dstslot == dvar);
>       canonicalize_values_star (dstslot, dst);
> -#ifdef ENABLE_CHECKING
> -      gcc_assert (dstslot
> -                 == shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash));
> -#endif
> +      gcc_checking_assert (dstslot
> +                          == shared_hash_find_slot_noinsert_1 (dst->vars,
> +                                                               dv, dvhash));
>       dvar = (variable)*dstslot;
>     }
>   else
> @@ -3660,11 +3635,9 @@ variable_merge_over_cur (variable s1var, struct dfset_merge *dsm)
>          dstslot = shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash);
>          gcc_assert (*dstslot == dvar);
>          canonicalize_values_star (dstslot, dst);
> -#ifdef ENABLE_CHECKING
> -         gcc_assert (dstslot
> -                     == shared_hash_find_slot_noinsert_1 (dst->vars,
> -                                                          dv, dvhash));
> -#endif
> +         gcc_checking_assert (dstslot
> +                              == shared_hash_find_slot_noinsert_1 (dst->vars,
> +                                                                   dv, dvhash));
>          dvar = (variable)*dstslot;
>        }
>     }
>
Richard Guenther - Oct. 21, 2010, 11:59 a.m.
On Thu, Oct 21, 2010 at 1:45 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Thu, Oct 21, 2010 at 1:41 PM, Nathan Froyd <froydnj@codesourcery.com> wrote:
>> The patch below replaces a number of instances of:
>>
>> #ifdef ENABLE_CHECKING
>>  gcc_assert (x)
>> #endif
>>
>> with the simpler:
>>
>>  gcc_checking_assert (x)
>>
>> It's actually slightly more aggressive than that; if we had something
>> like:
>>
>> #ifdef ENABLE_CHECKING
>>  for (...)
>>    gcc_assert (x)
>> #endif
>>
>> I've gone ahead and replaced the gcc_assert there with ENABLE_CHECKING,
>> on the assumption that the compiler will be able to optimize out the
>> empty for loop.  I've not replaced cases like:
>>
>> #ifdef ENABLE_CHECKING
>>  {
>>    thing x = func (...);
>>
>>    gcc_assert (y);
>>  }
>> #endif
>>
>> as the compiler might not be able to tell x is dead (func might have
>> side-effects).  It's certainly possible that such blocks could be
>> modified once func is checked for constness of parameters and so forth;
>> I just did the brainless replacements.
>>
>> Tested on x86_64-unknown-linux-gnu.  OK to commit?
>
> I think that #ifdefed loops are more easy to identify as enabled
> only in checkin mode.  And I'd be not so sure that the iterators
> themselves are optimized if the loop is empty (they have calls
> to non-inline fns at least).
>
> The rest of the changes is ok.

Which means that the changes removing the #ifdef around loops
are not.  Just in case that wasn't clear.

Richard.
Paolo Bonzini - Oct. 21, 2010, 3:59 p.m.
On 10/21/2010 01:45 PM, Richard Guenther wrote:
> I think that #ifdefed loops are more easy to identify as enabled
> only in checkin mode.  And I'd be not so sure that the iterators
> themselves are optimized if the loop is empty (they have calls
> to non-inline fns at least).

Pointer chasing (e.g. on NEXT_INSN) is also not optimized, since it may 
trap.

Paolo

Patch

diff --git a/gcc/basic-block.h b/gcc/basic-block.h
index e3b6e20..f175208 100644
--- a/gcc/basic-block.h
+++ b/gcc/basic-block.h
@@ -560,9 +560,7 @@  single_pred_p (const_basic_block bb)
 static inline edge
 single_succ_edge (const_basic_block bb)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (single_succ_p (bb));
-#endif
+  gcc_checking_assert (single_succ_p (bb));
   return EDGE_SUCC (bb, 0);
 }
 
@@ -572,9 +570,7 @@  single_succ_edge (const_basic_block bb)
 static inline edge
 single_pred_edge (const_basic_block bb)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (single_pred_p (bb));
-#endif
+  gcc_checking_assert (single_pred_p (bb));
   return EDGE_PRED (bb, 0);
 }
 
@@ -606,9 +602,7 @@  typedef struct {
 static inline VEC(edge,gc) *
 ei_container (edge_iterator i)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (i.container);
-#endif
+  gcc_checking_assert (i.container);
   return *i.container;
 }
 
@@ -659,9 +653,7 @@  ei_one_before_end_p (edge_iterator i)
 static inline void
 ei_next (edge_iterator *i)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (i->index < EDGE_COUNT (ei_container (*i)));
-#endif
+  gcc_checking_assert (i->index < EDGE_COUNT (ei_container (*i)));
   i->index++;
 }
 
@@ -669,9 +661,7 @@  ei_next (edge_iterator *i)
 static inline void
 ei_prev (edge_iterator *i)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (i->index > 0);
-#endif
+  gcc_checking_assert (i->index > 0);
   i->index--;
 }
 
diff --git a/gcc/cfghooks.c b/gcc/cfghooks.c
index 3532b46..c6e4bc0 100644
--- a/gcc/cfghooks.c
+++ b/gcc/cfghooks.c
@@ -906,9 +906,7 @@  duplicate_block (basic_block bb, edge e, basic_block after)
   if (bb->count < new_count)
     new_count = bb->count;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (can_duplicate_block_p (bb));
-#endif
+  gcc_checking_assert (can_duplicate_block_p (bb));
 
   new_bb = cfg_hooks->duplicate_block (bb);
   if (after)
diff --git a/gcc/cfglayout.c b/gcc/cfglayout.c
index 9fc05fe..8a0d35c 100644
--- a/gcc/cfglayout.c
+++ b/gcc/cfglayout.c
@@ -828,10 +828,8 @@  fixup_reorder_chain (void)
 				       : label_for_bb (e_fall->dest)), 0))
 		    {
 		      e_fall->flags &= ~EDGE_FALLTHRU;
-#ifdef ENABLE_CHECKING
-		      gcc_assert (could_fall_through
-				  (e_taken->src, e_taken->dest));
-#endif
+		      gcc_checking_assert (could_fall_through
+					   (e_taken->src, e_taken->dest));
 		      e_taken->flags |= EDGE_FALLTHRU;
 		      update_br_prob_note (bb);
 		      e = e_fall, e_fall = e_taken, e_taken = e;
@@ -852,10 +850,8 @@  fixup_reorder_chain (void)
 				     : label_for_bb (e_fall->dest)), 0))
 		{
 		  e_fall->flags &= ~EDGE_FALLTHRU;
-#ifdef ENABLE_CHECKING
-		  gcc_assert (could_fall_through
-			      (e_taken->src, e_taken->dest));
-#endif
+		  gcc_checking_assert (could_fall_through
+				       (e_taken->src, e_taken->dest));
 		  e_taken->flags |= EDGE_FALLTHRU;
 		  update_br_prob_note (bb);
 		  continue;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index e46050d..a158112 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -2692,9 +2692,7 @@  cfg_layout_can_merge_blocks_p (basic_block a, basic_block b)
 static void
 cfg_layout_merge_blocks (basic_block a, basic_block b)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (cfg_layout_can_merge_blocks_p (a, b));
-#endif
+  gcc_checking_assert (cfg_layout_can_merge_blocks_p (a, b));
 
   if (dump_file)
     fprintf (dump_file, "merging block %d into block %d\n", b->index, a->index);
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 342ad63..e1f47c2 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -594,10 +594,9 @@  cgraph_add_thunk (tree alias, tree decl, bool this_adjusting,
   
   node = cgraph_same_body_alias_1 (alias, decl);
   gcc_assert (node);
-#ifdef ENABLE_CHECKING
-  gcc_assert (!virtual_offset
-  	      || tree_int_cst_equal (virtual_offset, size_int (virtual_value)));
-#endif
+  gcc_checking_assert (!virtual_offset
+		       || tree_int_cst_equal (virtual_offset,
+					      size_int (virtual_value)));
   node->thunk.fixed_offset = fixed_offset;
   node->thunk.this_adjusting = this_adjusting;
   node->thunk.virtual_value = virtual_value;
@@ -984,11 +983,9 @@  cgraph_create_edge_1 (struct cgraph_node *caller, struct cgraph_node *callee,
      have not been loaded yet.  */
   if (call_stmt)
     {
-#ifdef ENABLE_CHECKING
-      /* This is rather pricely check possibly trigerring construction of
-	 call stmt hashtable.  */
-      gcc_assert (!cgraph_edge (caller, call_stmt));
-#endif
+      /* This is a rather expensive check possibly trigerring
+	 construction of call stmt hashtable.  */
+      gcc_checking_assert (!cgraph_edge (caller, call_stmt));
 
       gcc_assert (is_gimple_call (call_stmt));
     }
@@ -2258,10 +2255,8 @@  cgraph_create_virtual_clone (struct cgraph_node *old_node,
   size_t i;
   struct ipa_replace_map *map;
 
-#ifdef ENABLE_CHECKING
   if (!flag_wpa)
-    gcc_assert  (tree_versionable_function_p (old_decl));
-#endif
+    gcc_checking_assert  (tree_versionable_function_p (old_decl));
 
   /* Make a new FUNCTION_DECL tree node */
   if (!args_to_skip)
diff --git a/gcc/ddg.c b/gcc/ddg.c
index 88aaf9b..d7b093b 100644
--- a/gcc/ddg.c
+++ b/gcc/ddg.c
@@ -262,10 +262,9 @@  add_cross_iteration_register_deps (ddg_ptr g, df_ref last_def)
   gcc_assert (last_def_node);
   gcc_assert (first_def);
 
-#ifdef ENABLE_CHECKING
   if (DF_REF_ID (last_def) != DF_REF_ID (first_def))
-    gcc_assert (!bitmap_bit_p (&bb_info->gen, DF_REF_ID (first_def)));
-#endif
+    gcc_checking_assert (!bitmap_bit_p (&bb_info->gen,
+					DF_REF_ID (first_def)));
 
   /* Create inter-loop true dependences and anti dependences.  */
   for (r_use = DF_REF_CHAIN (last_def); r_use != NULL; r_use = r_use->next)
diff --git a/gcc/df-core.c b/gcc/df-core.c
index 7c49ccd..8d40d2f 100644
--- a/gcc/df-core.c
+++ b/gcc/df-core.c
@@ -1211,12 +1211,11 @@  df_analyze (void)
   for (i = 0; i < df->n_blocks; i++)
     bitmap_set_bit (current_all_blocks, df->postorder[i]);
 
-#ifdef ENABLE_CHECKING
   /* Verify that POSTORDER_INVERTED only contains blocks reachable from
      the ENTRY block.  */
   for (i = 0; i < df->n_blocks_inverted; i++)
-    gcc_assert (bitmap_bit_p (current_all_blocks, df->postorder_inverted[i]));
-#endif
+    gcc_checking_assert (bitmap_bit_p (current_all_blocks,
+				       df->postorder_inverted[i]));
 
   /* Make sure that we have pruned any unreachable blocks from these
      sets.  */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index d19a5cd..33a7b56 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -12715,15 +12715,14 @@  modified_type_die (tree type, int is_const_type, int is_volatile_type,
       && TYPE_NAME (qualified_type)
       && TREE_CODE (TYPE_NAME (qualified_type)) == TYPE_DECL)
     {
-#ifdef ENABLE_CHECKING
-      gcc_assert (TREE_CODE (TREE_TYPE (TYPE_NAME (qualified_type)))
-		  == INTEGER_TYPE
-		  && TYPE_PRECISION (TREE_TYPE (TYPE_NAME (qualified_type)))
-		     == TYPE_PRECISION (qualified_type)
-		  && TYPE_UNSIGNED (TREE_TYPE (TYPE_NAME (qualified_type)))
-		     == TYPE_UNSIGNED (qualified_type));
-#endif
-      qualified_type = TREE_TYPE (TYPE_NAME (qualified_type));
+      tree t = TREE_TYPE (TYPE_NAME (qualified_type));
+
+      gcc_checking_assert (TREE_CODE (t) == INTEGER_TYPE
+			   && TYPE_PRECISION (t)
+			   == TYPE_PRECISION (qualified_type)
+			   && TYPE_UNSIGNED (t)
+			   == TYPE_UNSIGNED (qualified_type));
+      qualified_type = t;
     }
 
   /* If we do, then we can just use its DIE, if it exists.  */
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 01dd70a..30c1f37 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -1839,10 +1839,8 @@  set_mem_attributes (rtx ref, tree t, int objectp)
 void
 set_mem_alias_set (rtx mem, alias_set_type set)
 {
-#ifdef ENABLE_CHECKING
   /* If the new and old alias sets don't conflict, something is wrong.  */
-  gcc_assert (alias_sets_conflict_p (set, MEM_ALIAS_SET (mem)));
-#endif
+  gcc_checking_assert (alias_sets_conflict_p (set, MEM_ALIAS_SET (mem)));
 
   MEM_ATTRS (mem) = get_mem_attrs (set, MEM_EXPR (mem), MEM_OFFSET (mem),
 				   MEM_SIZE (mem), MEM_ALIGN (mem),
@@ -3980,12 +3978,10 @@  delete_insns_since (rtx from)
 void
 reorder_insns_nobb (rtx from, rtx to, rtx after)
 {
-#ifdef ENABLE_CHECKING
   rtx x;
   for (x = from; x != to; x = NEXT_INSN (x))
-    gcc_assert (after != x);
-  gcc_assert (after != to);
-#endif
+    gcc_checking_assert (after != x);
+  gcc_checking_assert (after != to);
 
   /* Splice this bunch out of where it is now.  */
   if (PREV_INSN (from))
diff --git a/gcc/ggc-zone.c b/gcc/ggc-zone.c
index 4338bb6..7d8420a 100644
--- a/gcc/ggc-zone.c
+++ b/gcc/ggc-zone.c
@@ -802,9 +802,7 @@  zone_allocate_marks (void)
 	  n++;
 #endif
 	}
-#ifdef ENABLE_CHECKING
-      gcc_assert (n == zone->n_small_pages);
-#endif
+      gcc_checking_assert (n == zone->n_small_pages);
     }
 
   /* We don't collect the PCH zone, but we do have to mark it
diff --git a/gcc/gimple-iterator.c b/gcc/gimple-iterator.c
index 064b7fe..d654f2f 100644
--- a/gcc/gimple-iterator.c
+++ b/gcc/gimple-iterator.c
@@ -597,9 +597,7 @@  void
 gsi_move_to_bb_end (gimple_stmt_iterator *from, basic_block bb)
 {
   gimple_stmt_iterator last = gsi_last_bb (bb);
-#ifdef ENABLE_CHECKING
-  gcc_assert (gsi_bb (last) == bb);
-#endif
+  gcc_checking_assert (gsi_bb (last) == bb);
 
   /* Have to check gsi_end_p because it could be an empty block.  */
   if (!gsi_end_p (last) && is_ctrl_stmt (gsi_stmt (last)))
diff --git a/gcc/gimple.c b/gcc/gimple.c
index fca7803..6547567 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -3999,10 +3999,8 @@  iterative_hash_gimple_type (tree type, hashval_t val,
   void **slot;
   struct sccs *state;
 
-#ifdef ENABLE_CHECKING
   /* Not visited during this DFS walk.  */
-  gcc_assert (!pointer_map_contains (sccstate, type));
-#endif
+  gcc_checking_assert (!pointer_map_contains (sccstate, type));
   state = XOBNEW (sccstate_obstack, struct sccs);
   *pointer_map_insert (sccstate, type) = state;
 
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 5fae5aa..6d220b9 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -899,9 +899,7 @@  create_single_entry_edge (sd_region *region)
        single edge pointing from outside into the loop.  */
     gcc_unreachable ();
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (find_single_entry_edge (region));
-#endif
+  gcc_checking_assert (find_single_entry_edge (region));
 }
 
 /* Check if the sd_region, mentioned in EDGE, has no exit bb.  */
@@ -967,9 +965,7 @@  create_single_exit_edge (sd_region *region)
     if (e->aux)
       ((sd_region *) e->aux)->exit = forwarder->dest;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (find_single_exit_edge (region));
-#endif
+  gcc_checking_assert (find_single_exit_edge (region));
 }
 
 /* Unmark the exit edges of all REGIONS.
@@ -1058,16 +1054,14 @@  build_graphite_scops (VEC (sd_region, heap) *regions,
       VEC_safe_push (scop_p, heap, *scops, scop);
 
       /* Are there overlapping SCoPs?  */
-#ifdef ENABLE_CHECKING
 	{
 	  int j;
 	  sd_region *s2;
 
 	  FOR_EACH_VEC_ELT (sd_region, regions, j, s2)
 	    if (s != s2)
-	      gcc_assert (!bb_in_sd_region (s->entry, s2));
+	      gcc_checking_assert (!bb_in_sd_region (s->entry, s2));
 	}
-#endif
     }
 }
 
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index 015f8b9..40f125d 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2727,14 +2727,12 @@  choose_ready (struct ready_list *ready, rtx *insn_ptr)
 	  {
 	    insn = ready_element (ready, i);
 
-#ifdef ENABLE_CHECKING
 	    /* If this insn is recognizable we should have already
 	       recognized it earlier.
 	       ??? Not very clear where this is supposed to be done.
 	       See dep_cost_1.  */
-	    gcc_assert (INSN_CODE (insn) >= 0
-			|| recog_memoized (insn) < 0);
-#endif
+	    gcc_checking_assert (INSN_CODE (insn) >= 0
+				 || recog_memoized (insn) < 0);
 
 	    ready_try [i]
 	      = (/* INSN_CODE check can be omitted here as it is also done later
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 7db27f3..2eda12a 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -230,12 +230,10 @@  cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
 #endif
   if (file)
     fprintf (file, "\nReclaiming functions:");
-#ifdef ENABLE_CHECKING
   for (node = cgraph_nodes; node; node = node->next)
-    gcc_assert (!node->aux);
+    gcc_checking_assert (!node->aux);
   for (vnode = varpool_nodes; vnode; vnode = vnode->next)
-    gcc_assert (!vnode->aux);
-#endif
+    gcc_checking_assert (!vnode->aux);
   varpool_reset_queue ();
   for (node = cgraph_nodes; node; node = node->next)
     if ((!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
@@ -782,7 +780,6 @@  function_and_variable_visibility (bool whole_program)
 	 and simplifies later passes.  */
       if (node->same_comdat_group && DECL_EXTERNAL (node->decl))
 	{
-#ifdef ENABLE_CHECKING
 	  struct cgraph_node *n;
 
 	  for (n = node->same_comdat_group;
@@ -790,8 +787,8 @@  function_and_variable_visibility (bool whole_program)
 	       n = n->same_comdat_group)
 	      /* If at least one of same comdat group functions is external,
 		 all of them have to be, otherwise it is a front-end bug.  */
-	      gcc_assert (DECL_EXTERNAL (n->decl));
-#endif
+	      gcc_checking_assert (DECL_EXTERNAL (n->decl));
+
 	  dissolve_same_comdat_group_list (node);
 	}
       gcc_assert ((!DECL_WEAK (node->decl) && !DECL_COMDAT (node->decl))
diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c
index 85a7c40..da63729 100644
--- a/gcc/lto-cgraph.c
+++ b/gcc/lto-cgraph.c
@@ -1309,10 +1309,8 @@  input_cgraph_1 (struct lto_file_decl_data *file_data,
       len = lto_input_uleb128 (ib);
     }
   /* AUX pointers should be all non-zero for nodes read from the stream.  */
-#ifdef ENABLE_CHECKING
   FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
-    gcc_assert (node->aux);
-#endif
+    gcc_checking_assert (node->aux);
   FOR_EACH_VEC_ELT (cgraph_node_ptr, nodes, i, node)
     {
       int ref = (int) (intptr_t) node->global.inlined_to;
@@ -1359,10 +1357,8 @@  input_varpool_1 (struct lto_file_decl_data *file_data,
 		     input_varpool_node (file_data, ib));
       len--;
     }
-#ifdef ENABLE_CHECKING
   FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
-    gcc_assert (!node->aux);
-#endif
+    gcc_checking_assert (!node->aux);
   FOR_EACH_VEC_ELT (varpool_node_ptr, varpool, i, node)
     {
       int ref = (int) (intptr_t) node->same_comdat_group;
diff --git a/gcc/lto-streamer-in.c b/gcc/lto-streamer-in.c
index 72ac6ec..50352e8 100644
--- a/gcc/lto-streamer-in.c
+++ b/gcc/lto-streamer-in.c
@@ -973,9 +973,7 @@  input_gimple_stmt (struct lto_input_block *ib, struct data_in *data_in,
 		     to unify some types and thus not find a proper
 		     field-decl here.  So only assert here if checking
 		     is enabled.  */
-#ifdef ENABLE_CHECKING
-		  gcc_assert (tem != NULL_TREE);
-#endif
+		  gcc_checking_assert (tem != NULL_TREE);
 		  if (tem != NULL_TREE)
 		    TREE_OPERAND (op, 1) = tem;
 		}
diff --git a/gcc/passes.c b/gcc/passes.c
index 1308ce9..1ee3400 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -1310,9 +1310,7 @@  execute_todo (unsigned int flags)
 static void
 verify_interpass_invariants (void)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (!fold_deferring_overflow_warnings_p ());
-#endif
+  gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
 }
 
 /* Clear the last verified flag.  */
diff --git a/gcc/predict.c b/gcc/predict.c
index eb91b87..40d147a 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -1915,11 +1915,9 @@  propagate_freq (basic_block head, bitmap tovisit)
       /* Compute frequency of basic block.  */
       if (bb != head)
 	{
-#ifdef ENABLE_CHECKING
 	  FOR_EACH_EDGE (e, ei, bb->preds)
-	    gcc_assert (!bitmap_bit_p (tovisit, e->src->index)
-			|| (e->flags & EDGE_DFS_BACK));
-#endif
+	    gcc_checking_assert (!bitmap_bit_p (tovisit, e->src->index)
+				 || (e->flags & EDGE_DFS_BACK));
 
 	  FOR_EACH_EDGE (e, ei, bb->preds)
 	    if (EDGE_INFO (e)->back_edge)
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index 8aa9978..20c144d 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -518,10 +518,8 @@  pp_base_format (pretty_printer *pp, text_info *text)
       *formatters[argno] = XOBFINISH (&buffer->chunk_obstack, const char *);
     }
 
-#ifdef ENABLE_CHECKING
   for (; argno < PP_NL_ARGMAX; argno++)
-    gcc_assert (!formatters[argno]);
-#endif
+    gcc_checking_assert (!formatters[argno]);
 
   /* Revert to normal obstack and wrapping mode.  */
   buffer->obstack = &buffer->formatted_obstack;
diff --git a/gcc/sched-ebb.c b/gcc/sched-ebb.c
index 8e69215..8090898 100644
--- a/gcc/sched-ebb.c
+++ b/gcc/sched-ebb.c
@@ -147,24 +147,22 @@  begin_schedule_ready (rtx insn, rtx last)
 
       e = find_fallthru_edge (last_bb->succs);
 
-#ifdef ENABLE_CHECKING
-      gcc_assert (!e || !(e->flags & EDGE_COMPLEX));
+      gcc_checking_assert (!e || !(e->flags & EDGE_COMPLEX));
 
-      gcc_assert (BLOCK_FOR_INSN (insn) == last_bb
-		  && !IS_SPECULATION_CHECK_P (insn)
-		  && BB_HEAD (last_bb) != insn
-		  && BB_END (last_bb) == insn);
+      gcc_checking_assert (BLOCK_FOR_INSN (insn) == last_bb
+			   && !IS_SPECULATION_CHECK_P (insn)
+			   && BB_HEAD (last_bb) != insn
+			   && BB_END (last_bb) == insn);
 
       {
 	rtx x;
 
 	x = NEXT_INSN (insn);
 	if (e)
-	  gcc_assert (NOTE_P (x) || LABEL_P (x));
+	  gcc_checking_assert (NOTE_P (x) || LABEL_P (x));
 	else
-	  gcc_assert (BARRIER_P (x));
+	  gcc_checking_assert (BARRIER_P (x));
       }
-#endif
 
       if (e)
 	{
diff --git a/gcc/sel-sched.c b/gcc/sel-sched.c
index d93ebaa..378e561 100644
--- a/gcc/sel-sched.c
+++ b/gcc/sel-sched.c
@@ -6360,7 +6360,6 @@  code_motion_process_successors (insn_t insn, av_set_t orig_ops,
         goto rescan;
     }
 
-#ifdef ENABLE_CHECKING
   /* Here, RES==1 if original expr was found at least for one of the
      successors.  After the loop, RES may happen to have zero value
      only if at some point the expr searched is present in av_set, but is
@@ -6368,12 +6367,11 @@  code_motion_process_successors (insn_t insn, av_set_t orig_ops,
      The exception is when the original operation is blocked by
      bookkeeping generated for another fence or for another path in current
      move_op.  */
-  gcc_assert (res == 1
-              || (res == 0
-                  && av_set_could_be_blocked_by_bookkeeping_p (orig_ops,
-							       static_params))
-              || res == -1);
-#endif
+  gcc_checking_assert (res == 1
+		       || (res == 0
+			   && av_set_could_be_blocked_by_bookkeeping_p (orig_ops,
+									static_params))
+		       || res == -1);
 
   /* Merge data, clean up, etc.  */
   if (res != -1 && code_motion_path_driver_info->after_merge_succs)
diff --git a/gcc/tree-call-cdce.c b/gcc/tree-call-cdce.c
index 7f0a3e2..25476e6 100644
--- a/gcc/tree-call-cdce.c
+++ b/gcc/tree-call-cdce.c
@@ -541,9 +541,7 @@  gen_conditions_for_pow (gimple pow_call, VEC (gimple, heap) *conds,
   tree base, expn;
   enum tree_code bc;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (check_pow (pow_call));
-#endif
+  gcc_checking_assert (check_pow (pow_call));
 
   *nconds = 0;
 
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 3c1ca2d..139d8f9 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -279,9 +279,7 @@  tree_forwarder_block_p (basic_block bb, bool phi_wanted)
       || (single_succ_edge (bb)->flags & EDGE_ABNORMAL))
     return false;
 
-#if ENABLE_CHECKING
-  gcc_assert (bb != ENTRY_BLOCK_PTR);
-#endif
+  gcc_checking_assert (bb != ENTRY_BLOCK_PTR);
 
   locus = single_succ_edge (bb)->goto_locus;
 
diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h
index 7103d23..1a62cdd 100644
--- a/gcc/tree-flow-inline.h
+++ b/gcc/tree-flow-inline.h
@@ -230,10 +230,8 @@  link_imm_use (ssa_use_operand_t *linknode, tree def)
   else
     {
       root = &(SSA_NAME_IMM_USE_NODE (def));
-#ifdef ENABLE_CHECKING
       if (linknode->use)
         gcc_checking_assert (*(linknode->use) == def);
-#endif
       link_imm_use_to_list (linknode, root);
     }
 }
@@ -556,13 +554,11 @@  phi_arg_index_from_use (use_operand_p use)
   root = gimple_phi_arg (phi, 0);
   index = element - root;
 
-#ifdef ENABLE_CHECKING
   /* Make sure the calculation doesn't have any leftover bytes.  If it does,
      then imm_use is likely not the first element in phi_arg_d.  */
-  gcc_assert ((((char *)element - (char *)root)
-	       % sizeof (struct phi_arg_d)) == 0
-	      && index < gimple_phi_capacity (phi));
-#endif
+  gcc_checking_assert ((((char *)element - (char *)root)
+			% sizeof (struct phi_arg_d)) == 0
+		       && index < gimple_phi_capacity (phi));
 
  return index;
 }
@@ -613,9 +609,7 @@  phi_ssa_name_p (const_tree t)
 {
   if (TREE_CODE (t) == SSA_NAME)
     return true;
-#ifdef ENABLE_CHECKING
-  gcc_assert (is_gimple_min_invariant (t));
-#endif
+  gcc_checking_assert (is_gimple_min_invariant (t));
   return false;
 }
 
@@ -975,9 +969,7 @@  static inline use_operand_p
 move_use_after_head (use_operand_p use_p, use_operand_p head,
 		      use_operand_p last_p)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
-#endif
+  gcc_checking_assert (USE_FROM_PTR (use_p) == USE_FROM_PTR (head));
   /* Skip head when we find it.  */
   if (use_p != head)
     {
diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c
index cbd629c..8237dd2 100644
--- a/gcc/tree-into-ssa.c
+++ b/gcc/tree-into-ssa.c
@@ -3009,12 +3009,10 @@  insert_updated_phi_nodes_for (tree var, bitmap_head *dfs, bitmap blocks,
   bitmap_iterator bi;
   unsigned i;
 
-#if defined ENABLE_CHECKING
   if (TREE_CODE (var) == SSA_NAME)
-    gcc_assert (is_old_name (var));
+    gcc_checking_assert (is_old_name (var));
   else
-    gcc_assert (symbol_marked_for_renaming (var));
-#endif
+    gcc_checking_assert (symbol_marked_for_renaming (var));
 
   /* Get all the definition sites for VAR.  */
   db = find_def_blocks_for (var);
diff --git a/gcc/tree-ssa-coalesce.c b/gcc/tree-ssa-coalesce.c
index be44d56..7615612 100644
--- a/gcc/tree-ssa-coalesce.c
+++ b/gcc/tree-ssa-coalesce.c
@@ -547,11 +547,9 @@  ssa_conflicts_test_p (ssa_conflicts_p ptr, unsigned x, unsigned y)
 {
   bitmap b;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (x < ptr->size);
-  gcc_assert (y < ptr->size);
-  gcc_assert (x != y);
-#endif
+  gcc_checking_assert (x < ptr->size);
+  gcc_checking_assert (y < ptr->size);
+  gcc_checking_assert (x != y);
 
   b = ptr->conflicts[x];
   if (b)
@@ -579,11 +577,9 @@  ssa_conflicts_add_one (ssa_conflicts_p ptr, unsigned x, unsigned y)
 static inline void
 ssa_conflicts_add (ssa_conflicts_p ptr, unsigned x, unsigned y)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (x < ptr->size);
-  gcc_assert (y < ptr->size);
-  gcc_assert (x != y);
-#endif
+  gcc_checking_assert (x < ptr->size);
+  gcc_checking_assert (y < ptr->size);
+  gcc_checking_assert (x != y);
   ssa_conflicts_add_one (ptr, x, y);
   ssa_conflicts_add_one (ptr, y, x);
 }
diff --git a/gcc/tree-ssa-copy.c b/gcc/tree-ssa-copy.c
index c82943c..a92b63b 100644
--- a/gcc/tree-ssa-copy.c
+++ b/gcc/tree-ssa-copy.c
@@ -211,12 +211,10 @@  replace_exp (use_operand_p op_p, tree val)
 void
 propagate_tree_value (tree *op_p, tree val)
 {
-#if defined ENABLE_CHECKING
-  gcc_assert (!(TREE_CODE (val) == SSA_NAME
-                && *op_p
-		&& TREE_CODE (*op_p) == SSA_NAME
-		&& !may_propagate_copy (*op_p, val)));
-#endif
+  gcc_checking_assert (!(TREE_CODE (val) == SSA_NAME
+			 && *op_p
+			 && TREE_CODE (*op_p) == SSA_NAME
+			 && !may_propagate_copy (*op_p, val)));
 
   if (TREE_CODE (val) == SSA_NAME)
     *op_p = val;
diff --git a/gcc/tree-ssa-dom.c b/gcc/tree-ssa-dom.c
index 54a35af..bab6ced 100644
--- a/gcc/tree-ssa-dom.c
+++ b/gcc/tree-ssa-dom.c
@@ -1852,10 +1852,8 @@  eliminate_redundant_computations (gimple_stmt_iterator* gsi)
            || useless_type_conversion_p (expr_type, TREE_TYPE (cached_lhs))))
       || may_propagate_copy_into_stmt (stmt, cached_lhs))
   {
-#if defined ENABLE_CHECKING
-      gcc_assert (TREE_CODE (cached_lhs) == SSA_NAME
-		  || is_gimple_min_invariant (cached_lhs));
-#endif
+      gcc_checking_assert (TREE_CODE (cached_lhs) == SSA_NAME
+			   || is_gimple_min_invariant (cached_lhs));
 
       if (dump_file && (dump_flags & TDF_DETAILS))
 	{
diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c
index a68755e..f4808e7 100644
--- a/gcc/tree-ssa-forwprop.c
+++ b/gcc/tree-ssa-forwprop.c
@@ -1286,10 +1286,8 @@  simplify_gimple_switch (gimple stmt)
 
 	      def = gimple_assign_rhs1 (def_stmt);
 
-#ifdef ENABLE_CHECKING
 	      /* ??? Why was Jeff testing this?  We are gimple...  */
-	      gcc_assert (is_gimple_val (def));
-#endif
+	      gcc_checking_assert (is_gimple_val (def));
 
 	      to = TREE_TYPE (cond);
 	      ti = TREE_TYPE (def);
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index a814f6f..0321a4b 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -469,10 +469,8 @@  execute_cse_reciprocals (void)
   calculate_dominance_info (CDI_DOMINATORS);
   calculate_dominance_info (CDI_POST_DOMINATORS);
 
-#ifdef ENABLE_CHECKING
   FOR_EACH_BB (bb)
-    gcc_assert (!bb->aux);
-#endif
+    gcc_checking_assert (!bb->aux);
 
   for (arg = DECL_ARGUMENTS (cfun->decl); arg; arg = DECL_CHAIN (arg))
     if (gimple_default_def (cfun, arg)
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index d4d108d..8f91bd6 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -895,9 +895,7 @@  bitmap_value_insert_into_set (bitmap_set_t set, pre_expr expr)
 {
   unsigned int val = get_expr_value_id (expr);
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (expr->id == get_or_alloc_expression_id (expr));
-#endif
+  gcc_checking_assert (expr->id == get_or_alloc_expression_id (expr));
 
   /* Constant values are always considered to be part of the set.  */
   if (value_id_constant_p (val))
@@ -2608,10 +2606,8 @@  compute_antic (void)
 						      block->index));
 	    }
 	}
-#ifdef ENABLE_CHECKING
       /* Theoretically possible, but *highly* unlikely.  */
-      gcc_assert (num_iterations < 500);
-#endif
+      gcc_checking_assert (num_iterations < 500);
     }
 
   statistics_histogram_event (cfun, "compute_antic iterations",
@@ -2640,10 +2636,8 @@  compute_antic (void)
 							    block->index));
 		}
 	    }
-#ifdef ENABLE_CHECKING
 	  /* Theoretically possible, but *highly* unlikely.  */
-	  gcc_assert (num_iterations < 500);
-#endif
+	  gcc_checking_assert (num_iterations < 500);
 	}
       statistics_histogram_event (cfun, "compute_partial_antic iterations",
 				  num_iterations);
diff --git a/gcc/tree-ssa-ter.c b/gcc/tree-ssa-ter.c
index 0fb8028..ca67ec0 100644
--- a/gcc/tree-ssa-ter.c
+++ b/gcc/tree-ssa-ter.c
@@ -223,17 +223,14 @@  static bitmap
 free_temp_expr_table (temp_expr_table_p t)
 {
   bitmap ret = NULL;
-
-#ifdef ENABLE_CHECKING
   unsigned x;
   for (x = 0; x <= num_var_partitions (t->map); x++)
-    gcc_assert (!t->kill_list[x]);
+    gcc_checking_assert (!t->kill_list[x]);
   for (x = 0; x < num_ssa_names; x++)
     {
-      gcc_assert (t->expr_decl_uids[x] == NULL);
-      gcc_assert (t->partition_dependencies[x] == NULL);
+      gcc_checking_assert (t->expr_decl_uids[x] == NULL);
+      gcc_checking_assert (t->partition_dependencies[x] == NULL);
     }
-#endif
 
   BITMAP_FREE (t->partition_in_use);
   BITMAP_FREE (t->new_replaceable_dependencies);
@@ -296,9 +293,7 @@  add_to_partition_kill_list (temp_expr_table_p tab, int p, int ver)
 static inline void
 remove_from_partition_kill_list (temp_expr_table_p tab, int p, int version)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (tab->kill_list[p]);
-#endif
+  gcc_checking_assert (tab->kill_list[p]);
   bitmap_clear_bit (tab->kill_list[p], version);
   if (bitmap_empty_p (tab->kill_list[p]))
     {
@@ -345,10 +340,8 @@  add_dependence (temp_expr_table_p tab, int version, tree var)
   else
     {
       i = var_to_partition (tab->map, var);
-#ifdef ENABLE_CHECKING
-      gcc_assert (i != NO_PARTITION);
-      gcc_assert (tab->num_in_part[i] != 0);
-#endif
+      gcc_checking_assert (i != NO_PARTITION);
+      gcc_checking_assert (tab->num_in_part[i] != 0);
       /* Only dependencies on ssa_names which are coalesced with something need
          to be tracked.  Partitions with containing only a single SSA_NAME
 	 *cannot* have their value changed.  */
@@ -479,9 +472,7 @@  process_replaceable (temp_expr_table_p tab, gimple stmt, int call_cnt)
   ssa_op_iter iter;
   bitmap def_vars, use_vars;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (is_replaceable_p (stmt));
-#endif
+  gcc_checking_assert (is_replaceable_p (stmt));
 
   def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
   version = SSA_NAME_VERSION (def);
@@ -534,9 +525,7 @@  kill_expr (temp_expr_table_p tab, int partition)
       finished_with_expr (tab, version, true);
     }
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (!tab->kill_list[partition]);
-#endif
+  gcc_checking_assert (!tab->kill_list[partition]);
 }
 
 
@@ -704,9 +693,7 @@  find_replaceable_exprs (var_map map)
   FOR_EACH_BB (bb)
     {
       find_replaceable_in_bb (table, bb);
-#ifdef ENABLE_CHECKING
-      gcc_assert (bitmap_empty_p (table->partition_in_use));
-#endif
+      gcc_checking_assert (bitmap_empty_p (table->partition_in_use));
     }
 
   ret = free_temp_expr_table (table);
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index c005c53..8ab986e 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -243,9 +243,7 @@  supports_overflow_infinity (const_tree type)
 static inline tree
 make_overflow_infinity (tree val)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (val != NULL_TREE && CONSTANT_CLASS_P (val));
-#endif
+  gcc_checking_assert (val != NULL_TREE && CONSTANT_CLASS_P (val));
   val = copy_node (val);
   TREE_OVERFLOW (val) = 1;
   return val;
@@ -256,9 +254,7 @@  make_overflow_infinity (tree val)
 static inline tree
 negative_overflow_infinity (tree type)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (supports_overflow_infinity (type));
-#endif
+  gcc_checking_assert (supports_overflow_infinity (type));
   return make_overflow_infinity (vrp_val_min (type));
 }
 
@@ -267,9 +263,7 @@  negative_overflow_infinity (tree type)
 static inline tree
 positive_overflow_infinity (tree type)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (supports_overflow_infinity (type));
-#endif
+  gcc_checking_assert (supports_overflow_infinity (type));
   return make_overflow_infinity (vrp_val_max (type));
 }
 
@@ -332,9 +326,7 @@  avoid_overflow_infinity (tree val)
     return vrp_val_max (TREE_TYPE (val));
   else
     {
-#ifdef ENABLE_CHECKING
-      gcc_assert (vrp_val_is_min (val));
-#endif
+      gcc_checking_assert (vrp_val_is_min (val));
       return vrp_val_min (TREE_TYPE (val));
     }
 }
@@ -4131,13 +4123,11 @@  register_new_assert_for (tree name, tree expr,
   assert_locus_t n, loc, last_loc;
   basic_block dest_bb;
 
-#if defined ENABLE_CHECKING
-  gcc_assert (bb == NULL || e == NULL);
+  gcc_checking_assert (bb == NULL || e == NULL);
 
   if (e == NULL)
-    gcc_assert (gimple_code (gsi_stmt (si)) != GIMPLE_COND
-		&& gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH);
-#endif
+    gcc_checking_assert (gimple_code (gsi_stmt (si)) != GIMPLE_COND
+			 && gimple_code (gsi_stmt (si)) != GIMPLE_SWITCH);
 
   /* Never build an assert comparing against an integer constant with
      TREE_OVERFLOW set.  This confuses our undefined overflow warning
@@ -5059,10 +5049,9 @@  process_assert_insertions_for (tree name, assert_locus_t loc)
     {
       /* We have been asked to insert the assertion on an edge.  This
 	 is used only by COND_EXPR and SWITCH_EXPR assertions.  */
-#if defined ENABLE_CHECKING
-      gcc_assert (gimple_code (gsi_stmt (loc->si)) == GIMPLE_COND
-	  || gimple_code (gsi_stmt (loc->si)) == GIMPLE_SWITCH);
-#endif
+      gcc_checking_assert (gimple_code (gsi_stmt (loc->si)) == GIMPLE_COND
+			   || (gimple_code (gsi_stmt (loc->si))
+			       == GIMPLE_SWITCH));
 
       gsi_insert_on_edge (loc->e, assert_stmt);
       return true;
diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c
index c74ef7c..c3d5077 100644
--- a/gcc/var-tracking.c
+++ b/gcc/var-tracking.c
@@ -1075,9 +1075,7 @@  dv_is_value_p (decl_or_value dv)
 static inline tree
 dv_as_decl (decl_or_value dv)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (dv_is_decl_p (dv));
-#endif
+  gcc_checking_assert (dv_is_decl_p (dv));
   return (tree) dv;
 }
 
@@ -1085,9 +1083,7 @@  dv_as_decl (decl_or_value dv)
 static inline rtx
 dv_as_value (decl_or_value dv)
 {
-#ifdef ENABLE_CHECKING
-  gcc_assert (dv_is_value_p (dv));
-#endif
+  gcc_checking_assert (dv_is_value_p (dv));
   return (rtx)dv;
 }
 
@@ -1136,9 +1132,7 @@  dv_from_decl (tree decl)
 {
   decl_or_value dv;
   dv = decl;
-#ifdef ENABLE_CHECKING
-  gcc_assert (dv_is_decl_p (dv));
-#endif
+  gcc_checking_assert (dv_is_decl_p (dv));
   return dv;
 }
 
@@ -1148,9 +1142,7 @@  dv_from_value (rtx value)
 {
   decl_or_value dv;
   dv = value;
-#ifdef ENABLE_CHECKING
-  gcc_assert (dv_is_value_p (dv));
-#endif
+  gcc_checking_assert (dv_is_value_p (dv));
   return dv;
 }
 
@@ -2182,10 +2174,8 @@  variable_union (variable src, dataflow_set *set)
 	      nnode->next = dnode;
 	      dnode = nnode;
 	    }
-#ifdef ENABLE_CHECKING
 	  else if (r == 0)
-	    gcc_assert (rtx_equal_p (dnode->loc, snode->loc));
-#endif
+	    gcc_checking_assert (rtx_equal_p (dnode->loc, snode->loc));
 
 	  if (r >= 0)
 	    snode = snode->next;
@@ -2549,17 +2539,13 @@  find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
   if (!var)
     return NULL;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (dv_onepart_p (var->dv));
-#endif
+  gcc_checking_assert (dv_onepart_p (var->dv));
 
   if (!var->n_var_parts)
     return NULL;
 
-#ifdef ENABLE_CHECKING
-  gcc_assert (var->var_part[0].offset == 0);
-  gcc_assert (loc != dv_as_opaque (var->dv));
-#endif
+  gcc_checking_assert (var->var_part[0].offset == 0);
+  gcc_checking_assert (loc != dv_as_opaque (var->dv));
 
   loc_code = GET_CODE (loc);
   for (node = var->var_part[0].loc_chain; node; node = node->next)
@@ -2591,20 +2577,16 @@  find_loc_in_1pdv (rtx loc, variable var, htab_t vars)
 	  while (node->next && GET_CODE (node->next->loc) == VALUE)
 	    {
 	      node = node->next;
-#ifdef ENABLE_CHECKING
-	      gcc_assert (!canon_value_cmp (node->loc,
-					    dv_as_value (var->dv)));
-#endif
+	      gcc_checking_assert (!canon_value_cmp (node->loc,
+						     dv_as_value (var->dv)));
 	      if (loc == node->loc)
 		return node;
 	    }
 	  continue;
 	}
 
-#ifdef ENABLE_CHECKING
-      gcc_assert (node == var->var_part[0].loc_chain);
-      gcc_assert (!node->next);
-#endif
+      gcc_checking_assert (node == var->var_part[0].loc_chain);
+      gcc_checking_assert (!node->next);
 
       dv = dv_from_value (node->loc);
       rvar = (variable) htab_find_with_hash (vars, dv, dv_htab_hash (dv));
@@ -2672,15 +2654,11 @@  intersect_loc_chains (rtx val, location_chain *dest, struct dfset_merge *dsm,
     {
       location_chain s2node;
 
-#ifdef ENABLE_CHECKING
-      gcc_assert (dv_onepart_p (s2var->dv));
-#endif
+      gcc_checking_assert (dv_onepart_p (s2var->dv));
 
       if (s2var->n_var_parts)
 	{
-#ifdef ENABLE_CHECKING
-	  gcc_assert (s2var->var_part[0].offset == 0);
-#endif
+	  gcc_checking_assert (s2var->var_part[0].offset == 0);
 	  s2node = s2var->var_part[0].loc_chain;
 
 	  for (; s1node && s2node;
@@ -2829,10 +2807,8 @@  loc_cmp (rtx x, rtx y)
       if (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
 	  < DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)))
 	return -1;
-#ifdef ENABLE_CHECKING
-      gcc_assert (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
-		  > DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)));
-#endif
+      gcc_checking_assert (DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (x))
+			   > DEBUG_TEMP_UID (DEBUG_EXPR_TREE_DECL (y)));
       return 1;
     }
 
@@ -3592,10 +3568,9 @@  variable_merge_over_cur (variable s1var, struct dfset_merge *dsm)
       dstslot = shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash);
       gcc_assert (*dstslot == dvar);
       canonicalize_values_star (dstslot, dst);
-#ifdef ENABLE_CHECKING
-      gcc_assert (dstslot
-		  == shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash));
-#endif
+      gcc_checking_assert (dstslot
+			   == shared_hash_find_slot_noinsert_1 (dst->vars,
+								dv, dvhash));
       dvar = (variable)*dstslot;
     }
   else
@@ -3660,11 +3635,9 @@  variable_merge_over_cur (variable s1var, struct dfset_merge *dsm)
 	  dstslot = shared_hash_find_slot_noinsert_1 (dst->vars, dv, dvhash);
 	  gcc_assert (*dstslot == dvar);
 	  canonicalize_values_star (dstslot, dst);
-#ifdef ENABLE_CHECKING
-	  gcc_assert (dstslot
-		      == shared_hash_find_slot_noinsert_1 (dst->vars,
-							   dv, dvhash));
-#endif
+	  gcc_checking_assert (dstslot
+			       == shared_hash_find_slot_noinsert_1 (dst->vars,
+								    dv, dvhash));
 	  dvar = (variable)*dstslot;
 	}
     }