]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/91355 (optimized code does not call destructor while unwindin...
authorJakub Jelinek <jakub@redhat.com>
Thu, 21 Nov 2019 13:53:57 +0000 (14:53 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 21 Nov 2019 13:53:57 +0000 (14:53 +0100)
PR tree-optimization/91355
* tree-ssa-sink.c (select_best_block): Use >= rather than >
for early_bb scaled count with best_bb count comparison.

* g++.dg/torture/pr91355.C: New test.

From-SVN: r278551

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/torture/pr91355.C [new file with mode: 0644]
gcc/tree-ssa-sink.c

index d2a01995be8efaf963ae3983ba3372acfd1b0bd9..b7c5c5617d11eb73d0f0a92c9ff3047df71a8cd0 100644 (file)
@@ -1,3 +1,9 @@
+2019-11-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91355
+       * tree-ssa-sink.c (select_best_block): Use >= rather than >
+       for early_bb scaled count with best_bb count comparison.
+
 2019-11-21  Richard Biener  <rguenther@suse.de>
 
        Revert
index 6fd3d9392b804b9d43a1b9b6b32563f19843e862..f3a8444820613edfa93eff12b8d267952aa286ba 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-21  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/91355
+       * g++.dg/torture/pr91355.C: New test.
+
 2019-11-20  Peter Bergner  <bergner@linux.ibm.com>
 
        Backport from mainline
diff --git a/gcc/testsuite/g++.dg/torture/pr91355.C b/gcc/testsuite/g++.dg/torture/pr91355.C
new file mode 100644 (file)
index 0000000..7a385dc
--- /dev/null
@@ -0,0 +1,28 @@
+// PR tree-optimization/91355
+// { dg-do run }
+// { dg-options "-std=c++14" }
+
+unsigned int d = 0;
+
+struct S {
+  S () { d++; }
+  S (const S &) { d++; }
+  ~S () { d--; }
+};
+
+void
+foo (int i) throw (int) // { dg-warning "dynamic exception specifications are deprecated" }
+{
+  if (i == 0)
+    throw 3;
+  S d;
+  throw 3;
+}
+
+int
+main ()
+{
+  try { foo (1); } catch (...) {}
+  if (d)
+    __builtin_abort ();
+}
index 8a64ab084e5defff9adfd873128e8bccdbc727fd..2648b24f7d5ed10bb15ce3e4d48b7af407a1bef9 100644 (file)
@@ -229,7 +229,7 @@ select_best_block (basic_block early_bb,
       /* If result of comparsion is unknown, preffer EARLY_BB.
         Thus use !(...>=..) rather than (...<...)  */
       && !(best_bb->count.apply_scale (100, 1)
-          > (early_bb->count.apply_scale (threshold, 1))))
+          >= early_bb->count.apply_scale (threshold, 1)))
     return best_bb;
 
   /* No better block found, so return EARLY_BB, which happens to be the