re PR debug/83585 (Assembler messages: Error: can't resolve `.text' {.text section...
authorJakub Jelinek <jakub@redhat.com>
Thu, 4 Jan 2018 17:47:55 +0000 (18:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 4 Jan 2018 17:47:55 +0000 (18:47 +0100)
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
gcc/bb-reorder.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr83585.c [new file with mode: 0644]

index a30a3069c96b49fa60492a460576b60f8526b165..622d648a8093da83fe43cd858c77d52e6867326a 100644 (file)
@@ -1,3 +1,9 @@
+2018-01-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/83585
+       * bb-reorder.c (insert_section_boundary_note): Set has_bb_partition
+       to switched_sections.
+
 2018-01-04  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR target/83680
index a6689628f1beb4c11fc350c5dcbd92ba51f5788f..f977082de5aa3504d9b029b6c73c332799c11f66 100644 (file)
@@ -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 {
index d871d49c5a3e6aaab729f0a810cbe78686cbb012..1ac4c5fdb66d6340c56643190088e8b1cba7422a 100644 (file)
@@ -1,3 +1,8 @@
+2018-01-04  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/83585
+       * gcc.dg/pr83585.c: New test.
+
 2018-01-04  Nathan Sidwell  <nathan@acm.org>
 
        PR c++/83667
diff --git a/gcc/testsuite/gcc.dg/pr83585.c b/gcc/testsuite/gcc.dg/pr83585.c
new file mode 100644 (file)
index 0000000..2a9cf25
--- /dev/null
@@ -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;
+}