From 64d620ef974744e0760111c379d53a39094442d7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 4 Jan 2018 18:47:55 +0100 Subject: [PATCH] re PR debug/83585 (Assembler messages: Error: can't resolve `.text' {.text section} - `.LCOLDB0' {.text.unlikely section}) PR debug/83585 * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition to switched_sections. * gcc.dg/pr83585.c: New test. From-SVN: r256256 --- gcc/ChangeLog | 6 ++++++ gcc/bb-reorder.c | 5 +++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr83585.c | 18 ++++++++++++++++++ 4 files changed, 34 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr83585.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a30a3069c96..622d648a809 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-01-04 Jakub Jelinek + + PR debug/83585 + * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition + to switched_sections. + 2018-01-04 Richard Sandiford PR target/83680 diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c index a6689628f1b..f977082de5a 100644 --- a/gcc/bb-reorder.c +++ b/gcc/bb-reorder.c @@ -2523,6 +2523,11 @@ insert_section_boundary_note (void) current_partition = BB_PARTITION (bb); } } + + /* Make sure crtl->has_bb_partition matches reality even if bbpart finds + some hot and some cold basic blocks, but later one of those kinds is + optimized away. */ + crtl->has_bb_partition = switched_sections; } namespace { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d871d49c5a3..1ac4c5fdb66 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-04 Jakub Jelinek + + PR debug/83585 + * gcc.dg/pr83585.c: New test. + 2018-01-04 Nathan Sidwell PR c++/83667 diff --git a/gcc/testsuite/gcc.dg/pr83585.c b/gcc/testsuite/gcc.dg/pr83585.c new file mode 100644 index 00000000000..2a9cf252eda --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr83585.c @@ -0,0 +1,18 @@ +/* PR debug/83585 */ +/* { dg-do assemble } */ +/* { dg-options "-std=gnu89 -O2 -g -fno-tree-dce -fno-guess-branch-probability" } */ + +int +foo (int x) +{ + int a, b; + for (a = 0; a < 2; ++a) + if (x != 0) + { + for (b = 0; b < 2; ++b) + ; + return 0; + } + + return; +} -- 2.30.2