aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-06-10 15:54:58 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-06-10 09:54:58 -0600
commit97623b520bfe0d1f1bf554c50ed14483240db321 (patch)
tree31f209db13c8363ab29aad0c1ff32a8294639a49 /gcc
parentc31783fd1860b2d74e91bc490d564680ba9f71c4 (diff)
downloadgcc-97623b520bfe0d1f1bf554c50ed14483240db321.zip
gcc-97623b520bfe0d1f1bf554c50ed14483240db321.tar.gz
gcc-97623b520bfe0d1f1bf554c50ed14483240db321.tar.bz2
gimple-fold.c (get_range_strlen): Update comment that didn't make it into r267503 or related commits.
gcc/ChangeLog: * gimple-fold.c (get_range_strlen): Update comment that didn't make it into r267503 or related commits. From-SVN: r272120
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-fold.c34
2 files changed, 15 insertions, 24 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 912ad18..9327d97 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2019-06-10 Martin Sebor <msebor@redhat.com>
+
+ * gimple-fold.c (get_range_strlen): Update comment that didn't
+ make it into r267503 or related commits.
+
2019-06-10 Vladislav Ivanishin <vlad@ispras.ru>
* gcov-tool.c (merge_usage, rewrite_usage): Mark with
diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index 8b8331e..dfb31a0 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -1672,30 +1672,16 @@ get_range_strlen (tree arg, bitmap *visited,
}
}
-/* Determine the minimum and maximum value or string length that ARG
- refers to and store each in the first two elements of MINMAXLEN.
- For expressions that point to strings of unknown lengths that are
- character arrays, use the upper bound of the array as the maximum
- length. For example, given an expression like 'x ? array : "xyz"'
- and array declared as 'char array[8]', MINMAXLEN[0] will be set
- to 0 and MINMAXLEN[1] to 7, the longest string that could be
- stored in array.
- Return true if the range of the string lengths has been obtained
- from the upper bound of an array at the end of a struct. Such
- an array may hold a string that's longer than its upper bound
- due to it being used as a poor-man's flexible array member.
-
- STRICT is true if it will handle PHIs and COND_EXPRs conservatively
- and false if PHIs and COND_EXPRs are to be handled optimistically,
- if we can determine string length minimum and maximum; it will use
- the minimum from the ones where it can be determined.
- STRICT false should be only used for warning code.
- When non-null, clear *NONSTR if ARG refers to a constant array
- that is known not be nul-terminated. Otherwise set it to
- the declaration of the constant non-terminated array.
-
- ELTSIZE is 1 for normal single byte character strings, and 2 or
- 4 for wide characer strings. ELTSIZE is by default 1. */
+/* Try to obtain the range of the lengths of the string(s) referenced
+ by ARG, or the size of the largest array ARG refers to if the range
+ of lengths cannot be determined, and store all in *PDATA. ELTSIZE
+ is the expected size of the string element in bytes: 1 for char and
+ some power of 2 for wide characters.
+ Return true if the range [PDATA->MINLEN, PDATA->MAXLEN] is suitable
+ for optimization. Returning false means that a nonzero PDATA->MINLEN
+ doesn't reflect the true lower bound of the range when PDATA->MAXLEN
+ is -1 (in that case, the actual range is indeterminate, i.e.,
+ [0, PTRDIFF_MAX - 2]. */
bool
get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize)