PR tree-optimization/82646 - bogus -Wstringop-overflow with -D_FORTIFY_SOURCE=2 on...
authorMartin Sebor <msebor@redhat.com>
Wed, 6 Dec 2017 17:59:01 +0000 (17:59 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 6 Dec 2017 17:59:01 +0000 (10:59 -0700)
commit9c1caf50e16b50903364709d774244928c719b35
tree37e9610f886770d0980145594fd7487eac2c1c1a
parent8a797929f09274ccbf95ee7d8e415d35c1f5b0d1
PR tree-optimization/82646 - bogus -Wstringop-overflow with -D_FORTIFY_SOURCE=2 on strncpy with range to a member array

gcc/ChangeLog:

PR tree-optimization/82646
* builtins.c (maybe_emit_chk_warning): Use size as the bound for
strncpy, not maxlen.

gcc/testsuite/ChangeLog:

PR tree-optimization/82646
* gcc.dg/builtin-stringop-chk-1.c: Adjust.
* gcc.dg/builtin-stringop-chk-9.c: New test.
* g++.dg/ext/strncpy-chk1.C: Adjust.

From-SVN: r255448
gcc/ChangeLog
gcc/builtins.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/strncpy-chk1.C
gcc/testsuite/gcc.dg/builtin-stringop-chk-1.c
gcc/testsuite/gcc.dg/builtin-stringop-chk-9.c [new file with mode: 0644]