Commit 97623b52 by Martin Sebor Committed by Martin Sebor

gimple-fold.c (get_range_strlen): Update comment that didn't make it into…

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
parent c31783fd
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> 2019-06-10 Vladislav Ivanishin <vlad@ispras.ru>
* gcov-tool.c (merge_usage, rewrite_usage): Mark with * gcov-tool.c (merge_usage, rewrite_usage): Mark with
......
...@@ -1672,30 +1672,16 @@ get_range_strlen (tree arg, bitmap *visited, ...@@ -1672,30 +1672,16 @@ get_range_strlen (tree arg, bitmap *visited,
} }
} }
/* Determine the minimum and maximum value or string length that ARG /* Try to obtain the range of the lengths of the string(s) referenced
refers to and store each in the first two elements of MINMAXLEN. by ARG, or the size of the largest array ARG refers to if the range
For expressions that point to strings of unknown lengths that are of lengths cannot be determined, and store all in *PDATA. ELTSIZE
character arrays, use the upper bound of the array as the maximum is the expected size of the string element in bytes: 1 for char and
length. For example, given an expression like 'x ? array : "xyz"' some power of 2 for wide characters.
and array declared as 'char array[8]', MINMAXLEN[0] will be set Return true if the range [PDATA->MINLEN, PDATA->MAXLEN] is suitable
to 0 and MINMAXLEN[1] to 7, the longest string that could be for optimization. Returning false means that a nonzero PDATA->MINLEN
stored in array. doesn't reflect the true lower bound of the range when PDATA->MAXLEN
Return true if the range of the string lengths has been obtained is -1 (in that case, the actual range is indeterminate, i.e.,
from the upper bound of an array at the end of a struct. Such [0, PTRDIFF_MAX - 2]. */
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. */
bool bool
get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize) get_range_strlen (tree arg, c_strlen_data *pdata, unsigned eltsize)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment