[Bug c/87028] false positive -Wstringop-truncation strncpy with global variable source string

msebor at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 20 16:38:00 GMT 2018


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2018-08-20
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=84474
     Ever confirmed|0                           |1

--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
The test case here is more compelling than the one in bug 84474 and I agree
that it would be helpful to avoid the warning, although not at the expense of
true positives.  Short of deferring the strncpy -> memcpy folding I don't see a
way to do it.  Let me confirm this report with the hope that GCC can change to
do the folding later.


More information about the Gcc-bugs mailing list