[Bug c++/24996] [4.0/4.1/4.2 Regression] ICE on throw code
mmitchel at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Mon Jan 23 05:11:00 GMT 2006
------- Comment #12 from mmitchel at gcc dot gnu dot org 2006-01-23 05:10 -------
I don't fully understand stabilize_expr; that's Jason's invention, IIRC.
However, I think that the problem is that for a COND_EXPR we can't pre-evaluate
both arms of the conditional, because only one of them is supposed to be
executed at runtime.
I think this is a bug in the gimplifier. I certainly don't see anything in the
documentation for CLEANUP_EXPR that suggests the restriction you've described.
I suppose that we could try to turn:
b ? T(x) : T(y)
into:
SAVE_EXPR b,
TARGET_EXPR (tmp, b ? T(&tmp, x) : T(&tmp, y), b ? cleanup1 : cleanup2)
but that seems difficult, and I'm not sure it would work.
By the way, here's a simpler test case:
struct A {
A();
~A();
};
struct S {
S(const A&);
~S();
};
void foo(bool b)
{
throw b ? S(A()) : throw 0;
}
--
mmitchel at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24996
More information about the Gcc-bugs
mailing list