Open
Description
Clang (and GCC) don't seem to recognize the __fh_overlap
macro in https://godbolt.org/z/EqjKe716r as a buffer aliasing check.
The sample was adapted from https://github.com/jvoisin/fortify-headers/blob/master/include/string.h, which is reportedly used in Musl-based Linux distributions like Alpine.
In this case, since r
was just allocated, the compiler should be able to reason that r
cannot overlap with a
and delete the __fh_overlap
check. It's also important to be able to optimize this because memcpy
is the usual pattern to load memory without tripping strict aliasing issues.