[Bug ipa/60600] [4.9 Regression] ICE in ipa_get_indirect_edge_target_1
lucdanton at free dot fr
gcc-bugzilla@gcc.gnu.org
Sat Mar 22 11:27:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60600
--- Comment #5 from lucdanton at free dot fr ---
(In reply to Martin Jambor from comment #2)
> Well, this is ICE on code with undefined behavior. Function test
> calls itself with a parameter which is a reference to an object of
> type child2 and then static_casts it to a reference to child1. These
> are non-PODs, neither of these types is an ancestor of the other and
> thus the use of static_cast is not allowed by the C++ standard.
> […]
I must apologise for the peculiar testcase I produced. I normally try to write
a sensible program or fragment, but in this case I couldn’t figure out where
the problematic behaviour was. In the end I resigned myself to (almost
mechanically) discard bits and bits of the original TU until I was left with
those things that triggered the ICE and nothing else.
(I can’t help but notice that if the testcase is made a complete program by
e.g. adding an empty main then strictly speaking there is no UB as control flow
never reaches the invalid cast — with the ICE still happening.)
For the record, and as best as I can tell, the original code was carefully
performing the downcasts inside a (type)case, with no overlap or fallthrough.
And if I do apply the patch you supplied, GCC does compile the library without
issue.
More information about the Gcc-bugs
mailing list