[gcc(refs/vendors/ibm/heads/gcc-9)] re PR tree-optimization/91355 (optimized code does not call destructor while unwinding after excepti

Peter Bergner bergner@gcc.gnu.org
Tue Feb 4 20:59:00 GMT 2020


https://gcc.gnu.org/g:ca124a1deec777b8173b362d8e4b2245e0765ba9

commit ca124a1deec777b8173b362d8e4b2245e0765ba9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Thu Nov 21 14:53:57 2019 +0100

    re PR tree-optimization/91355 (optimized code does not call destructor while unwinding after exception)
    
    	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

Diff:
---
 gcc/ChangeLog                          |  6 ++++++
 gcc/testsuite/ChangeLog                |  5 +++++
 gcc/testsuite/g++.dg/torture/pr91355.C | 28 ++++++++++++++++++++++++++++
 gcc/tree-ssa-sink.c                    |  2 +-
 4 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d2a0199..b7c5c56 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6fd3d93..f3a8444 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..7a385dc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr91355.C
@@ -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 ();
+}
diff --git a/gcc/tree-ssa-sink.c b/gcc/tree-ssa-sink.c
index 8a64ab0..2648b24 100644
--- a/gcc/tree-ssa-sink.c
+++ b/gcc/tree-ssa-sink.c
@@ -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



More information about the Gcc-cvs mailing list