From: Richard Biener Date: Fri, 7 Jun 2019 12:14:55 +0000 (+0000) Subject: re PR debug/90574 ([gdb] gdb wrongly stopped at a breakpoint in an unexecuted line... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e733243a3693142bd9c9486451c38d2dc20270ac;p=gcc.git re PR debug/90574 ([gdb] gdb wrongly stopped at a breakpoint in an unexecuted line of code) 2019-06-07 Richard Biener PR debug/90574 * tree-cfg.c (stmt_starts_bb_p): Split blocks at labels that appear after user labels. * gcc.misc-tests/gcov-pr90574-1.c: New testcase. * gcc.misc-tests/gcov-pr90574-2.c: Likewise. From-SVN: r272040 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1cffe10a32..41e364b7f48 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-07 Richard Biener + + PR debug/90574 + * tree-cfg.c (stmt_starts_bb_p): Split blocks at labels + that appear after user labels. + 2019-06-07 Martin Liska * cselib.c (cselib_init): Disable hash table diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9410686a9f7..75ff9daf2e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-06-07 Richard Biener + + PR debug/90574 + * gcc.misc-tests/gcov-pr90574-1.c: New testcase. + * gcc.misc-tests/gcov-pr90574-2.c: Likewise. + 2019-06-07 Jan Hubicka * gcc.dg/lto/alias-access-path-2.0.c: New testcase. diff --git a/gcc/testsuite/gcc.misc-tests/gcov-pr90574-1.c b/gcc/testsuite/gcc.misc-tests/gcov-pr90574-1.c new file mode 100644 index 00000000000..41ac9bb3ecc --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/gcov-pr90574-1.c @@ -0,0 +1,20 @@ +/* { dg-options "-fprofile-arcs -ftest-coverage" } */ +/* { dg-do run { target native } } */ + +int main(int argc, char **argv) +{ + if (argc == 0) + { + int *ptr; +label: /* count(#####) */ + { + } + } + if (argc == 1) + { + __builtin_printf("hello\n"); + } + return 0; +} + +/* { dg-final { run-gcov gcov-pr90574-1.c } } */ diff --git a/gcc/testsuite/gcc.misc-tests/gcov-pr90574-2.c b/gcc/testsuite/gcc.misc-tests/gcov-pr90574-2.c new file mode 100644 index 00000000000..2db70c96f71 --- /dev/null +++ b/gcc/testsuite/gcc.misc-tests/gcov-pr90574-2.c @@ -0,0 +1,15 @@ +/* { dg-options "-fprofile-arcs -ftest-coverage" } */ +/* { dg-do run { target native } } */ + +int main(int argc, char **argv) +{ + switch (argc) + { + case 0: + foo: /* count(#####) */ + case 1:; + } + return 0; +} + +/* { dg-final { run-gcov gcov-pr90574-2.c } } */ diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 94b258498dc..a585efea3d8 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -2722,10 +2722,10 @@ stmt_starts_bb_p (gimple *stmt, gimple *prev_stmt) || FORCED_LABEL (gimple_label_label (label_stmt))) return true; - if (prev_stmt && gimple_code (prev_stmt) == GIMPLE_LABEL) + if (glabel *plabel = safe_dyn_cast (prev_stmt)) { - if (DECL_NONLOCAL (gimple_label_label ( - as_a (prev_stmt)))) + if (DECL_NONLOCAL (gimple_label_label (plabel)) + || !DECL_ARTIFICIAL (gimple_label_label (plabel))) return true; cfg_stats.num_merged_labels++;