aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-09-14 03:34:19 +0000
committerJeff Law <law@gcc.gnu.org>2018-09-13 21:34:19 -0600
commit6ab24ea809555eeb869fe49595f22ed9c8737cc4 (patch)
treea6a98bb3c25e71934a2ae133c6e5116dcb9349b9 /gcc/gimple-ssa-sprintf.c
parentd01b568a78351beb6b693b613e6b48bcb2475eae (diff)
downloadgcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.zip
gcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.tar.gz
gcc-6ab24ea809555eeb869fe49595f22ed9c8737cc4.tar.bz2
builtins.h (c_srlen): Add argument.
* builtins.h (c_srlen): Add argument. * builtins.c (warn_string_no_nul): New function. (c_strlen): Add argument and use it. Update recursive calls. Pass DECL argument to string_constant to get info on non terminated strings. Update *NONSTR as needed. (fold_builtin_strlen): Add argument to calls to c_strlen. Warn for unterminated arrays. (warn_string_no_null): Add prototype. * expr.c (string_constant): Update arguments. Update recursive calls appropriately. Detect missing NUL terminator and outermost declaration its missing in. Improve checks for arrays with nonzero lower bound or elements that are not a single byte. Simplify offset computation. Simplify checks for non-NUL terminated strings. * gimple-fold.c (get_range_strlen): Add argument to c_strlen call. * gimple-ssa-sprintf.c (get_string_length): Remove unnecessary code. * gcc.dg/warn-strlen-no-nul.c: New test. Co-Authored-By: Bernd Edlinger <bernd.edlinger@hotmail.de> Co-Authored-By: Jeff Law <law@redhat.com> From-SVN: r264302
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c7
1 files changed, 0 insertions, 7 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 91e21af..9f3eebc 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1999,13 +1999,6 @@ get_string_length (tree str, unsigned eltsize)
if (!str)
return fmtresult ();
- if (tree slen = c_strlen (str, 1, eltsize))
- {
- /* Simply return the length of the string. */
- fmtresult res (tree_to_shwi (slen));
- return res;
- }
-
/* Determine the length of the shortest and longest string referenced
by STR. Strings of unknown lengths are bounded by the sizes of
arrays that subexpressions of STR may refer to. Pointers that