UBSan: Incorrect generated __ubsan_handle_type_mismatch_v1
?
#136592
Labels
compiler-rt:ubsan
Undefined behavior sanitizer
question
A question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!
In apache/arrow we encountered a weird UBSan error (apache/arrow#46124 (comment)) which seems to be a false alarm. A reduced case can be found here .
To summarize, for function:
A misaligned
src
shouldn't be considered UB because it is merely passed intostd::memcpy
asvoid *
which requires no alignment. However the generated code jumps to__ubsan_handle_type_mismatch_v1
once misaligned regardless of how it is used afterwards.As a comparison, changing the pointer type from
uint64_t *
touint8_t *
gets the correct codegen - no alignment checking:The same behavior is observed on X86 as well, and as early as 18.1.0 (17.0.1 is fine) for both Arm and X86.
The text was updated successfully, but these errors were encountered: