cgraph_node::get_create (cfun->decl);
cgraph_edge::rebuild_edges ();
}
+
+ /* Perform IL validation and if any error is found abort compilation
+ of this function by zapping its body. */
+ if ((cfun->curr_properties & PROP_cfg)
+ && verify_gimple_in_cfg (cfun, false, false))
+ init_empty_tree_cfg ();
+ else if (!(cfun->curr_properties & PROP_cfg)
+ && verify_gimple_in_seq (gimple_body (current_function_decl), false))
+ gimple_set_body (current_function_decl, NULL);
+
dump_function (TDI_gimple, current_function_decl);
}
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-fgimple" } */
+
+unsigned a;
+static double *d;
+static _Bool b;
+__GIMPLE int
+foo (int n)
+{
+ b = __builtin_add_overflow (n, *d, &a);
+} /* { dg-error "invalid argument" } */
+
+/* { dg-message "" "" { target *-*-* } 0 } */
/* Verify the GIMPLE statements inside the statement list STMTS. */
-DEBUG_FUNCTION void
-verify_gimple_in_seq (gimple_seq stmts)
+DEBUG_FUNCTION bool
+verify_gimple_in_seq (gimple_seq stmts, bool ice)
{
timevar_push (TV_TREE_STMT_VERIFY);
- if (verify_gimple_in_seq_2 (stmts))
+ bool res = verify_gimple_in_seq_2 (stmts);
+ if (res && ice)
internal_error ("%<verify_gimple%> failed");
timevar_pop (TV_TREE_STMT_VERIFY);
+ return res;
}
/* Return true when the T can be shared. */
/* Verify the GIMPLE statements in the CFG of FN. */
-DEBUG_FUNCTION void
-verify_gimple_in_cfg (struct function *fn, bool verify_nothrow)
+DEBUG_FUNCTION bool
+verify_gimple_in_cfg (struct function *fn, bool verify_nothrow, bool ice)
{
basic_block bb;
bool err = false;
eh_table->traverse<hash_set<gimple *> *, verify_eh_throw_stmt_node>
(&visited_throwing_stmts);
- if (err || eh_error_found)
+ if (ice && (err || eh_error_found))
internal_error ("verify_gimple failed");
verify_histograms ();
timevar_pop (TV_TREE_STMT_VERIFY);
+
+ return (err || eh_error_found);
}
extern gimple *first_stmt (basic_block);
extern gimple *last_stmt (basic_block);
extern gimple *last_and_only_stmt (basic_block);
-extern void verify_gimple_in_seq (gimple_seq);
-extern void verify_gimple_in_cfg (struct function *, bool);
+extern bool verify_gimple_in_seq (gimple_seq, bool = true);
+extern bool verify_gimple_in_cfg (struct function *, bool, bool = true);
extern tree gimple_block_label (basic_block);
extern void add_phi_args_after_copy_bb (basic_block);
extern void add_phi_args_after_copy (basic_block *, unsigned, edge);