[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-18 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

--- Comment #13 from Martin Liška  ---
The replacement you described fully makes sense for me! As I mentioned earlier,
I'm not c++ expert, I can't come up with more possible counter examples that
worth for testing.

However, we'll fix further issues ;)

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-17 Thread redbeard0531 at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

--- Comment #12 from Mathias Stearn  ---
We were hoping to replace many places in our code that does the following with
noexcept attributes on functions:

> try {doStuffThatShouldntThrow();} catch(...) {std::terminate();}

We wanted to take advantage of noexcept preventing exceptions from propagating
in a way that causes the terminate handler to be invoked at the throw site
rather than the catch site. We've avoided doing this so far because of the bugs
that we've found, leaving us with low confidence that we can rely on it. Can
you think of any similar cases that are likely to cause issues? Where do you
think it makes sense to focus our testing?

The scariest issues we've seen were a combination of failures to enforce
noexcept (like this bug) combined with noexcept causing try/catch blocks to be
optimized out. That lead to an exception thrown from a noexcept function
bypassing the surrounding catch block and escaping two layers of protection and
reaching code that really should never see them. Are there any compiler flags
we can use to tell it not to eliminate the catches based on noexcept
annotations?

We've also noticed that 'throw()' annotations have fewer issues, but have
avoided them because they are deprecated. As compiler writers, would you trust
'throw()' more or suggest we stick with noexcept?

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-17 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Martin Liška  ---
Fixed on all active branches.

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-17 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

--- Comment #10 from Martin Liška  ---
Author: marxin
Date: Mon Oct 17 13:19:04 2016
New Revision: 241240

URL: https://gcc.gnu.org/viewcvs?rev=241240=gcc=rev
Log:
Do not merge BBs with a different EH landing pads (PR

Backported from mainline
2016-10-13  Martin Liska  

PR tree-optimization/77943
* g++.dg/tree-ssa/pr77943.C: New test.
Backported from mainline
2016-10-13  Martin Liska  

PR tree-optimization/77943
* tree-ssa-tail-merge.c (merge_stmts_p): Do not merge BBs with
a different EH landing pads.

Added:
branches/gcc-5-branch/gcc/testsuite/g++.dg/tree-ssa/pr77943.C
Modified:
branches/gcc-5-branch/gcc/ChangeLog
branches/gcc-5-branch/gcc/testsuite/ChangeLog
branches/gcc-5-branch/gcc/tree-ssa-tail-merge.c

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-17 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

--- Comment #9 from Martin Liška  ---
Author: marxin
Date: Mon Oct 17 13:17:53 2016
New Revision: 241239

URL: https://gcc.gnu.org/viewcvs?rev=241239=gcc=rev
Log:
Do not merge BBs with a different EH landing pads (PR

Backported from mainline
2016-10-13  Martin Liska  

PR tree-optimization/77943
* g++.dg/tree-ssa/pr77943.C: New test.
Backported from mainline
2016-10-13  Martin Liska  

PR tree-optimization/77943
* tree-ssa-tail-merge.c (merge_stmts_p): Do not merge BBs with
a different EH landing pads.

Added:
branches/gcc-6-branch/gcc/testsuite/g++.dg/tree-ssa/pr77943.C
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/testsuite/ChangeLog
branches/gcc-6-branch/gcc/tree-ssa-tail-merge.c

[Bug tree-optimization/77943] [5/6 Regression] Optimization incorrectly commons noexcept calls with non-noexcept calls

2016-10-13 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

Martin Liška  changed:

   What|Removed |Added

Summary|[5/6/7 Regression]  |[5/6 Regression]
   |Optimization incorrectly|Optimization incorrectly
   |commons noexcept calls with |commons noexcept calls with
   |non-noexcept calls  |non-noexcept calls

--- Comment #8 from Martin Liška  ---
Fixed on trunk.