summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-13 18:48:23 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2017-12-13 18:48:23 +0000
commit70da6508ca2312d77b0a58c8212944322d5985a8 (patch)
treea1ae549ee0c7749ca98677ccd2b290b58a71fb6d
parented9480c149a116ab3a97468cb2fd1b9a21990352 (diff)
downloadgcc-70da6508ca2312d77b0a58c8212944322d5985a8.tar.gz
* tree-cfg.c (verify_gimple_in_cfg): Verify no non-label stmts
with the exception of debug begin stmt markers appear before labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255611 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-cfg.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 943c8793bc2..420d84b38e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2017-12-13 Jakub Jelinek <jakub@redhat.com>
+ * 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 9a4e3e206a1..75a0a302e96 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));