]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR debug/83585
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Jan 2018 17:47:55 +0000 (17:47 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 4 Jan 2018 17:47:55 +0000 (17:47 +0000)
* bb-reorder.c (insert_section_boundary_note): Set has_bb_partition
to switched_sections.

* gcc.dg/pr83585.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@256256 138bc75d-0d04-0410-961f-82ee72b054a4

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;
+}