[Bug c/94444] __attribute__((access(...))) ignored for memcpy when compiling with -Os
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Apr 1 19:46:35 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94444
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |WONTFIX
Keywords| |diagnostic
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Attribute access has an effect only on calls present in the IL after all
optimizations have run. In the test case, because the local variable isn't
used after the copy, the call is removed and there is no warning. (The warning
comes back if the buffer is used or made extern or static.) This is by design,
and expected not just of the attribute but of most late warnings (including,
for example, -Warray-bounds). Doing otherwise and processing the attribute
much earlier would lead to warnings for unreachable code that most users view
as false positives. We have no plans to change it.
More information about the Gcc-bugs
mailing list