[cfe-dev] devirtualisation appears to crash clang on covariant functions on ARM
David Tweed
david.tweed at arm.com
Tue Oct 23 01:04:18 PDT 2012
> 1. Does the devirtualiser work in the presence of covariant returns? If it
> doesn't then it's unlikely the devirtualiser will work with destructors when
> using the ARM ABI.
| Not in general, since that can require pointer updates if one type is
| not at offset 0 of the other.
Right, talking to people who implement other compilers that issue had been mentioned.
> 2. If it does work (even if covariance prevents devirtualisation), how can
> it be stopped from crashing in the verifier in cases like this?
| Is the return visible at the C++ level at all?
I don't believe that there's any way to observe this at the actual C++ level. (Presumably you could use some inline some assembly that new about this, but that's presumably beyond any standard.)
| If the return is not visible in C++, can you just
| create a new llvm variable that is being created to hold it and add a
| bitcast to the original one?
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?
Cheers,
Dave
More information about the cfe-dev
mailing list