[Bug middle-end/94169] warn for modifying getenv() result

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 16 19:10:02 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94169

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|88781                       |

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
On second thought, rather than extending -Wstringop-overflow it might be better
to diagnoses this under "modifying a const object" as requested in 90404.  In
addition, rather than diagnosing only built-in functions (and growing the list
GCC would have to recognize just to detect bugs), providing an attribute to let
users denote pointers to non-modifiable objects would be a better solution.  It
could be an entirely new attribute or it could be done by extending the
existing access attribute read_only to apply also to pointers returned from
functions and even to data members.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88781
[Bug 88781] [meta-bug] bogus/missing -Wstringop-truncation warnings


More information about the Gcc-bugs mailing list