http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52939

--- Comment #4 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-13 
09:58:44 UTC ---
(In reply to comment #3)
> Created attachment 27143 [details]
> Simple testcase
> 
> This should be a simpler testcase.  What happens is that we are
> attempting to devirtualize call to a virtual method introduced in a
> descendant but with an ancestor which does not have it.  I suppose
> this is OK if the call is never executed in run-time.
> 
> Dealing with this situation in gimple_get_virt_method_for_binfo would
> be easy, but perhaps we want fold_ctor_reference to return NULL is it
> is requested to fold an expression from beyond the provided
> constructor?

Well, if we know what the size of the constructor target is, yes.  Otherwise
all non-initialized parts are implicitely initialized to zero.

Thus, you need to handle this case in gimple_get_virt_method_for_binfo
anyway (fails are always better than asserts ...)

Reply via email to