diff options
author | Richard Biener <rguenther@suse.de> | 2022-09-07 12:01:34 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-09-08 16:05:17 +0200 |
commit | 78ef801b7263606d27a6a752a40cbeecc584fb3d (patch) | |
tree | b523e083051e0bed3f186cc7716ece05e98c280f /gcc/tree-cfg.cc | |
parent | 4db3cb781c355341fa041e6b5bbbfc495c6a0fdb (diff) | |
download | gcc-78ef801b7263606d27a6a752a40cbeecc584fb3d.zip gcc-78ef801b7263606d27a6a752a40cbeecc584fb3d.tar.gz gcc-78ef801b7263606d27a6a752a40cbeecc584fb3d.tar.bz2 |
Fix some gimple_ctrl_altering_p mistakes
CFG cleanup resets the control altering flag for noreturn functions
when they are ECF_LEAF (like __builtin_unreachable ()). The
.ABNORMAL_DISPATCHER call built during CFG construction is not
marked as control altering. Several passes inserting traps or
unreachables fail to set the flag. And more.
PR middle-end/106870
* gimple-harden-conditionals.cc (insert_check_and_trap):
Set the control-altering flag on the built IFN_TRAP.
* gimple.cc (gimple_build_builtin_unreachable): Likewise.
* tree-cfg.cc (handle_abnormal_edges): Set the control-altering
flag on the .ABNORMAL_DISPATCHER call.
* tree-cfgcleanup.cc (cleanup_call_ctrl_altering_flag): Avoid
resetting the control altering flag for ECF_NORETURN calls.
(cleanup_control_flow_bb): Set the control altering flag on
discovered noreturn calls.
* symtab-thunks.cc (expand_thunk): Set the control altering
flag for the noreturn tailcall case.
* tree-eh.cc (lower_resx): Likewisw for trap and unwind_resume
calls.
Diffstat (limited to 'gcc/tree-cfg.cc')
-rw-r--r-- | gcc/tree-cfg.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index bbe0835..e39d947 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -821,8 +821,9 @@ handle_abnormal_edges (basic_block *dispatcher_bbs, basic_block for_bb, else { tree arg = inner ? boolean_true_node : boolean_false_node; - gimple *g = gimple_build_call_internal (IFN_ABNORMAL_DISPATCHER, + gcall *g = gimple_build_call_internal (IFN_ABNORMAL_DISPATCHER, 1, arg); + gimple_call_set_ctrl_altering (g, true); gimple_stmt_iterator gsi = gsi_after_labels (*dispatcher); gsi_insert_after (&gsi, g, GSI_NEW_STMT); |