On 07/19/2018 12:04 PM, Bernd Edlinger wrote:
> Hi,
>
>
> this fixes a few minor nits, which I spotted while
> looking at the string folding functions:
>
> string_constant: Remove impossible check: TREE_CODE (arg)
> can't be COMPONENT_REF and MEM_REF at the same time.
Shouldn't they all be != tests? Though clearly this code isn't being
tested by anything.
>
> c_strlen: maxelts is (signed) HOST_WIDE_INT, therefore
> use tree_to_shwi.
One could argue maxelts should be unsigned.
>
> c_getstr: tree_to_uhwi needs to be protected by
> tree_fits_uhwi_p.
Looks correct to me.
>
> BTW: c_getstr uses string_constant which appears to be
> able to extract wide char string initializers, but c_getstr
> does not seem to be prepared for wide char strings:
>
> else if (string[string_length - 1] != '\0')
> {
> /* Support only properly NUL-terminated strings but handle
> consecutive strings within the same array, such as the six
> substrings in "1\0002\0003". */
> return NULL;
> }
Seems like a goof to me.
jeff
Jeff