https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96987
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |INVALID --- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> --- The warning is by design and based on the assumption that a function declared to take a const pointer (or in C++, a const reference) as an argument reads the pointed-to-object. If that's not the case annotating the function declaration with attribute as shgwn below suppresses the warning: extern __attribute__ ((access (none, 1))) void constparam(const int *ptr);