-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Open
Labels
TBAAType-Based Alias Analysis / Strict AliasingType-Based Alias Analysis / Strict AliasingclangClang issues not falling into any other categoryClang issues not falling into any other categorymissed-optimization
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.
Metadata
Metadata
Assignees
Labels
TBAAType-Based Alias Analysis / Strict AliasingType-Based Alias Analysis / Strict AliasingclangClang issues not falling into any other categoryClang issues not falling into any other categorymissed-optimization