[Bug tree-optimization/49115] invalid return value optimization (?) when exception is thrown and caught
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun May 22 20:56:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49115
Richard Guenther <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.05.22 20:33:26
Component|c++ |tree-optimization
AssignedTo|unassigned at gcc dot |rguenth at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
Known to fail| |4.7.0
--- Comment #1 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-22 20:33:26 UTC ---
Confirmed. Reduced testcase:
extern "C" void abort (void);
struct MyException {};
struct Data {
int nr;
Data() : nr(66) {}
};
Data __attribute__((noinline,noclone)) getData(int i)
{
if (i) throw MyException();
Data data;
data.nr = i;
return data;
}
int main(int, char **)
{
Data data;
try {
data = getData(1);
} catch (MyException& e) {
if (data.nr != 66)
abort ();
}
}
what happens is that the store to data.nr from the constructor call in
main is DCEd. Looks like an alias issue to me. Mine.
More information about the Gcc-bugs
mailing list