> @@ -567,13 +597,17 @@ string_length (const void *ptr, unsigned eltsize, > unsigned maxelts) > accesses. Note that this implies the result is not going to be emitted > into the instruction stream. > > + When ARR is non-null and the string is not properly nul-terminated, > + set *ARR to the declaration of the outermost constant object whose > + initializer (or one of its elements) is not nul-terminated. > + > The value returned is of type `ssizetype'. > > Unfortunately, string_constant can't access the values of const char > arrays with initializers, so neither can we do so here. */
Maybe drop that sentence when it is no longer true? > > tree > -c_strlen (tree src, int only_value) > +c_strlen (tree src, int only_value, tree *arr /* = NULL */) > { > STRIP_NOPS (src); > if (TREE_CODE (src) == COND_EXPR > @@ -581,24 +615,31 @@ c_strlen (tree src, int only_value) > { > tree len1, len2; > > - len1 = c_strlen (TREE_OPERAND (src, 1), only_value); > - len2 = c_strlen (TREE_OPERAND (src, 2), only_value); > + len1 = c_strlen (TREE_OPERAND (src, 1), only_value, arr); > + len2 = c_strlen (TREE_OPERAND (src, 2), only_value, arr); Wow, what happens here if the first operand is non-zero terminated and the second is zero-terminated? > if (tree_int_cst_equal (len1, len2)) > return len1; > } > > if (TREE_CODE (src) == COMPOUND_EXPR > && (only_value || !TREE_SIDE_EFFECTS (TREE_OPERAND (src, 0)))) Bernd.