[clang] -fsanitize=alignment: check memcpy/memmove arguments (PR #67766)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 1 10:12:14 PDT 2023


zygoloid wrote:

> @zygoloid Is reusing the message for regular stores clear (current behavior) enough?
> 
> ```
> // CHECK-MEMCPY-STORE: misaligned.cpp:[[#@LINE+4]]{{(:12)?}}: runtime error: store to misaligned address [[PTR:0x[0-9a-f]*]] for type 'int *', which requires 4 byte alignment
> ```

I predict we'll get a bug report saying "I didn't do a store, I used `memcpy`, which is specified as doing a byte-by-byte copy". But given that improving this would require adding a new entry point into the runtime library, and we don't know how common or rare this situation will be, I think it's probably OK to wait until someone complains.

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


More information about the cfe-commits mailing list