builtins.c (unterminated_array): Handle ARRAY_REF.
authorMartin Sebor <msebor@redhat.com>
Fri, 14 Sep 2018 18:35:26 +0000 (18:35 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 14 Sep 2018 18:35:26 +0000 (12:35 -0600)
commit01b0acb7610032d5f6bb32cc6ecda5955cb0c18a
tree3cfc9708ab0990085d890f7f087d045398095e16
parente08341bb0e026ef019a3b201ea26ecdc4a9233ea
builtins.c (unterminated_array): Handle ARRAY_REF.

* builtins.c (unterminated_array): Handle ARRAY_REF.
(expand_builtin_stpcpy_1): Detect unterminated char arrays.
* builtins.h (unterminated_array): Declare extern.
* gimple-fold.c (gimple_fold_builtin_stpcpy): Detect unterminated
  arrays.
(gimple_fold_builtin_sprintf): Propagate NO_WARNING to transformed
calls.

* gcc.dg/warn-stpcpy-no-nul.c: New test.

From-SVN: r264328
gcc/ChangeLog
gcc/builtins.c
gcc/builtins.h
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/warn-stpcpy-no-nul.c [new file with mode: 0644]