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.