PR tree-optimization/83671 - Fix for false positive reported by -Wstringop-overflow...
authorMartin Sebor <msebor@redhat.com>
Wed, 10 Jan 2018 21:40:14 +0000 (21:40 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 10 Jan 2018 21:40:14 +0000 (14:40 -0700)
commitc42d0aa0893cab444366c80fdd5b23bb45de6276
treefafafff32b2c7dda509c5af6251cf14765cc834f
parente7c6abad7f0bcbf0e60d27bc8cff1087c5195f76
PR tree-optimization/83671 - Fix for false positive reported by -Wstringop-overflow does not work with inlining

gcc/testsuite/ChangeLog:

PR tree-optimization/83671
* gcc.dg/strlenopt-40.c: New test.
* gcc.dg/strlenopt-41.c: New test.

gcc/ChangeLog:

PR tree-optimization/83671
* builtins.c (c_strlen): Unconditionally return zero for the empty
string.
Use -Warray-bounds for warnings.
* gimple-fold.c (get_range_strlen): Handle non-constant lengths
for non-constant array indices with COMPONENT_REF, arrays of
arrays, and pointers to arrays.
(gimple_fold_builtin_strlen): Determine and set length range for
non-constant character arrays.

From-SVN: r256457
gcc/ChangeLog
gcc/builtins.c
gcc/gimple-fold.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/warn/string1.C
gcc/testsuite/gcc.dg/strlenopt-40.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/strlenopt-41.c [new file with mode: 0644]