On 02/06/2018 05:46 AM, Marek Polacek wrote:
> When -Wstringop-truncation sees a strncpy call where the specified bound
> is equal to the size of the destination, it looks at the next statement
> to see if it's dst[i] = '\0';, and if it is, it doesn't warn.  But it
> needs to look at the next nondebug statement, otherwise we can get a
> false positive with -g, as this testcase shows.
> 
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
> 
> 2018-02-06  Marek Polacek  <pola...@redhat.com>
> 
>       PR tree-optimization/84228
>       * tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Skip debug statements.
> 
>       * c-c++-common/Wstringop-truncation-3.c: New test.
OK.
jeff

Reply via email to