[compiler-rt] [compiler-rt][ubsan][nfc-ish] Fix a type conversion bug (PR #100665)

Alan Zhao via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 16:12:16 PDT 2024


================
@@ -207,7 +207,8 @@ struct VtablePrefix {
   std::type_info *TypeInfo;
 };
 VtablePrefix *getVtablePrefix(void *Vtable) {
-  Vtable = ptrauth_strip(Vtable, ptrauth_key_cxx_vtable_pointer);
+  Vtable = reinterpret_cast<void *>(
----------------
alanzhao1 wrote:

Chrome was seeing build failures when building compiler-rt for android - see https://crbug.com/355271781#comment3.

The problem was that if we used the inline asm version of `ptrauth_strip(...)`, it woud return a `unsigned long` that would be assigned to `Vtable`, a variable of type `void *`, causing an incompatible type conversion compile failure.

This PR has been updated to fix the return value of `ptrauth_strip(...)`, but LLVM's style seem to be to explicitly cast the value to the desired type anyways.

https://github.com/llvm/llvm-project/pull/100665


More information about the llvm-commits mailing list