builtins.c (unterminated_array): Add new arguments.
authorMartin Sebor <msebor@redhat.com>
Tue, 2 Oct 2018 14:08:53 +0000 (14:08 +0000)
committerJeff Law <law@gcc.gnu.org>
Tue, 2 Oct 2018 14:08:53 +0000 (08:08 -0600)
commit6c4aa5f6bd8aacf51ddceb78239a7a2da0a1b959
tree0ca3592e4948a9bcd6eeb25e34636deb6d1732e5
parent469218a3f9b8f72b38d82dd978ec231ab3de14ef
builtins.c (unterminated_array): Add new arguments.

* builtins.c (unterminated_array): Add new arguments.
If argument is not terminated, bubble up size and exact
state to callers.
(expand_builtin_strnlen): Detect, avoid expanding
and diagnose unterminated arrays.
(c_strlen): Fill in offset of start of unterminated strings.
* builtins.h (unterminated_array): Update prototype.

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

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