gimple-fold.h (get_range_strlen): Update prototype.
authorMartin Sebor <msebor@redhat.com>
Wed, 2 Jan 2019 06:02:37 +0000 (06:02 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 2 Jan 2019 06:02:37 +0000 (23:02 -0700)
commit5d6655ebcc96030644f99eb1c431dd96e374db90
tree254a28a425e845f22414200219cf3f13aec1f0a6
parent79b1c2295b3031764904ce66ae294aa57aef50ae
gimple-fold.h (get_range_strlen): Update prototype.

* gimple-fold.h (get_range_strlen): Update prototype.
* builtins.c (check_access): Update call to get_range_strlen to use
c_strlen_data pointer.   Change various variable accesses to instead
pull data from the c_strlen_data structure.
(check_strncat_sizes, expand_builtin_strncat): Likewise.
* calls.c (maybe_warn_nonstring_arg): Likewise.
* tree-ssa-strlen.c (maybe_diag_stxncpy_trunc): Likewise.  Reset
minimum length if maximum lengh is unknown.
* gimple-ssa-sprintf.c (get_string_length): Likewise.  Drop code
that used c_strlen, it's no longer needed.  Restructure slightly.
(format_string): Set unlikely range appropriately.
* gimple-fold.c (get_range_strlen): Update comments.  Fix minor
formatting issues.
(get_range_strlen):  Accept c_strlen_data pointer for external
call sites as well.  Pass through to call to internal get_range_strlen.
Adjust minlen, maxlen and maxbound as needed.
(get_maxval_strlen): Update comments.
(gimple_fold_builtin_strlen):  Update call to get_range_strlen
to use c_strlen_data pointer.  Change variable accesses to instead
use c_strlen_data data members.

* gcc.dg/strlenopt-40.c: Disable a couple tests.
* gcc.dg/strlenopt-48.c: Twiddle test.
* gcc.dg/strlenopt-59.c: New test.
* gcc.dg/tree-ssa/builtin-snprintf-5.c: New test.
* g++.dg/init/strlen.C: New test.

Co-Authored-By: Jeff Law <law@redhat.com>
From-SVN: r267503
13 files changed:
gcc/ChangeLog
gcc/builtins.c
gcc/calls.c
gcc/gimple-fold.c
gcc/gimple-fold.h
gcc/gimple-ssa-sprintf.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/strlen.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-40.c
gcc/testsuite/gcc.dg/strlenopt-48.c
gcc/testsuite/gcc.dg/strlenopt-59.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/tree-ssa/builtin-snprintf-5.c [new file with mode: 0644]
gcc/tree-ssa-strlen.c