https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91355
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
Component|c++ |tree-optimization
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Slightly cleaned up testcase for g++.dg/torture/
// PR tree-optimization/91355
// { dg-do run { target c++14_down } }
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" "" { target c++11 } }
{
if (i == 0)
throw 3;
S d;
throw 3;
}
int
main ()
{
try { foo (1); } catch (...) {}
if (d)
__builtin_abort ();
}
The sink pass first sinks d = d - 1; statements across resx 4; into a new basic
block which is made new successor of the bb containing resx 4;, so:
<L2>:
d.1_16 = d;
_17 = d.1_16 + 4294967295;
d = _17;
resx 4
becomes:
<L2>:
resx 4
<bb 10> [count: 0]:
<L7>:
d.1_16 = d;
_17 = d.1_16 + 4294967295;
d = _17;
goto <bb 6>; [100.00%]
sink_code_in_bb has:
/* We can't move things across abnormal edges, so don't try. */
FOR_EACH_EDGE (e, ei, bb->succs)
if (e->flags & EDGE_ABNORMAL)
goto earlyout;
Shouldn't that be & (EDGE_ABNORMAL | EDGE_EH) ? Or are there any cases where
we actually want to sink something across EH edge? Even if yes, we shouldn't
put anything before landing pads IMHO.