From: Jakub Jelinek Date: Wed, 13 Dec 2017 18:48:23 +0000 (+0100) Subject: tree-cfg.c (verify_gimple_in_cfg): Verify no non-label stmts with the exception of... X-Git-Tag: basepoints/gcc-9~2703 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7bd169c861d0e696db036753c2935f86583fef49;p=thirdparty%2Fgcc.git tree-cfg.c (verify_gimple_in_cfg): Verify no non-label stmts with the exception of debug begin stmt markers appear... * tree-cfg.c (verify_gimple_in_cfg): Verify no non-label stmts with the exception of debug begin stmt markers appear before labels. From-SVN: r255611 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 943c8793bc29..420d84b38e06 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2017-12-13 Jakub Jelinek + * tree-cfg.c (verify_gimple_in_cfg): Verify no non-label stmts + with the exception of debug begin stmt markers appear before + labels. + PR bootstrap/83396 * final.c (rest_of_handle_final): Call variable_tracking_main only if !flag_var_tracking. diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 9a4e3e206a15..75a0a302e96f 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -5380,6 +5380,7 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow) err |= err2; } + bool label_allowed = true; for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); @@ -5396,6 +5397,19 @@ verify_gimple_in_cfg (struct function *fn, bool verify_nothrow) err2 = true; } + /* Labels may be preceded only by debug markers, not debug bind + or source bind or any other statements. */ + if (gimple_code (stmt) == GIMPLE_LABEL) + { + if (!label_allowed) + { + error ("gimple label in the middle of a basic block"); + err2 = true; + } + } + else if (!gimple_debug_begin_stmt_p (stmt)) + label_allowed = false; + err2 |= verify_gimple_stmt (stmt); err2 |= verify_location (&blocks, gimple_location (stmt));