[Bug middle-end/70987] missing -Wuninitialized calling built-in string functions with an uninitialized argument

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Sep 6 23:43:00 GMT 2016


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
I agree this bug can be handled as a duplicate of bug 10138.  It makes sense to
issue a "may be uninitialized" warning when passing the address of a
uninitialized local variable to a function that takes a const pointer (or const
reference in C++) since the called function is most likely going to read the
value of the variable.

It seems that it should be possible to enhance the warn_uninitialized_vars
function in tree-ssa-uninit.c to detect this case.  If I have time I'll try to
look into it.

*** This bug has been marked as a duplicate of bug 10138 ***


More information about the Gcc-bugs mailing list