https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77943

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |wrong-code
   Last reconfirmed|                            |2016-10-12
          Component|c++                         |tree-optimization
     Ever confirmed|0                           |1
            Summary|Optimization incorrectly    |[5/6/7 Regression]
                   |commons noexcept calls with |Optimization incorrectly
                   |non-noexcept calls          |commons noexcept calls with
                   |                            |non-noexcept calls
   Target Milestone|---                         |5.5
      Known to fail|                            |4.8.5, 5.2.0, 6.2.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
It's tail-merging commoning BB3 and BB4 in

void func(bool) (bool callFatal)
Eh tree:
   1 must_not_throw
{
  <bb 2>:
  if (callFatal_2(D) != 0)
    goto <bb 3>;
  else
    goto <bb 4>;

  <bb 3>:
  thrower ();

  <bb 4>:
  [MNT 1] thrower ();

}

A regression at least from tail-merging introduction.

OTOH it might be simply undefined behavior if you throw from inside a
must-not-throw region?  Would have to double-check the C++ standard for this.
(if invoking std::terminate is required)

Reply via email to