https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89924
Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> --- > (In reply to Jan Hubicka from comment #3) > > The reason why we do not devirtualize is that only information about Aint is > > the type of function parameter > > and we do not believe it implies the type of > > memory location it points to because there is no read or anything from that > > pointer before it is casted to struct A* and pointer of a given type does > > not need to necessarily point to memory location of the same type unless you > > dereference it. > > > > Is it really valid to devirtualize here? I think if the object were not an actual Aint, performing the standard conversion to A* should be undefined, allowing the devirtualization. But I'm not finding actual wording to that effect in the current draft.