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

Rafael EspĂ­ndola rafael.espindola at gmail.com
Mon Oct 22 10:38:09 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.

> 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? If so, I don't think
you have an option other than implementing support for covariant
return or detecting that case in destructors and avoiding
devirtualizing. 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?

> Many thanks for any assistance,
> Dave

Cheers,
Rafael



More information about the cfe-dev mailing list