[cfe-dev] devirtualisation appears to crash clang on covariant functions on ARM

John McCall rjmccall at apple.com
Tue Oct 23 11:52:30 PDT 2012


On Oct 23, 2012, at 5:33 AM, Rafael EspĂ­ndola wrote:
>> That sounds like quite an involved patch, since (if I understand things correctly) you'd have to do this during the ABI-fixing stage, which would require determining that the devirtualisation pass did devirtualise the call. As an intermediate step to avoid the crash and get the regression test completing, albeit failing, how about a patch to avoid devirtualising destructors on ARM: would that be ok?
> 
> I was under the impression that you could build the cast at the end of
> CodeGenFunction::EmitCXXMemberCallExpr. Instead of
> 
> return EmitCXXMemberCall...
> 
> you would have
> 
> foo =  return EmitCXXMemberCall
> if (needs cast)
>  foo = cast foo;
> return foo;
> 
> wouldn't that work? I will let John comment about the option of
> disabling devirtualization of destructorns on ARM.

Killing all frontend devirtualization of destructors is a bit over-the-top.

Note that we shouldn't actually need a conversion here because, while
destructors do generally return 'this', the correctness of that return value
is not guaranteed for *virtual* destructor calls, basically so that we don't
have to thunk them just to maintain this optimization.  So I'd like to know
what's actually introducing a dependence on the return value.

John.



More information about the cfe-dev mailing list