builtins.c (unterminated_array): New.
authorMartin Sebor <msebor@redhat.com>
Fri, 14 Sep 2018 18:23:58 +0000 (18:23 +0000)
committerJeff Law <law@gcc.gnu.org>
Fri, 14 Sep 2018 18:23:58 +0000 (12:23 -0600)
commite08341bb0e026ef019a3b201ea26ecdc4a9233ea
tree85a654a129f0c74bd85567d343cb3ba067c3c9c4
parentdd98382b8b016c9af092f77b47dfb7eaf35db426
builtins.c (unterminated_array): New.

* builtins.c (unterminated_array): New.
(expand_builtin_strcpy): Adjust.
(expand_builtin_strcpy_args): Detect unterminated arrays.
* gimple-fold.c (get_maxval_strlen): Add argument.  Detect
unterminated arrays.
* gimple-fold.h (get_maxval_strlen): Add argument.
(gimple_fold_builtin_strcpy): Detec unterminated arrays.

* gimple-fold.c (get_range_strlen): Add argument.
(get_maxval_strlen): Adjust.
* gimple-fold.h (get_range_strlen): Add argument.

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

Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r264327
gcc/ChangeLog
gcc/builtins.c
gcc/gimple-fold.c
gcc/gimple-fold.h
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/warn-strcpy-no-nul.c [new file with mode: 0644]