[compiler-rt] [ubsan] Use internal_memcpy to copy ubsan bits size (PR #121586)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 3 09:36:38 PST 2025
earnol wrote:
> lgtm. out of interest, did you run into this in practice anywhere?
Nope. Just noticed that nobody still addressed this comment and thought it might be reasonable to handle it in appropriate way. The reason is some platforms (Sony Emotion Engine for example) works in those situations, but actually return incorrect value.
For example, you request u32 value from address 0x5672, but actually you are getting value from the address 0x5670 because it is nearest aligned address.
So, Jakub comment is totally valid and needs to be addressed.
The proper way would be to use ifdef to separate platforms working with non-aligned values from platforms behaving improperly, but i was not able to locate such define.
Another way to ensure the value is always 32-bit aligned, but it is quite complex without demanding a more global alignment and wasting more bytes.
Considering the performance is not an issue here, i went with this approach.
https://github.com/llvm/llvm-project/pull/121586
More information about the llvm-commits
mailing list