[Bug rtl-optimization/89490] [9 Regression] char array constant put in string merge section
bernd.edlinger at hotmail dot de
gcc-bugzilla@gcc.gnu.org
Tue Feb 26 18:33:00 GMT 2019
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89490
--- Comment #14 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Jakub Jelinek from comment #13)
>
> Well, it matches what output_constant does:
> case STRING_CST:
> thissize = (unsigned HOST_WIDE_INT)TREE_STRING_LENGTH (exp);
> if (merge_strings
> && (thissize == 0
> || TREE_STRING_POINTER (exp) [thissize - 1] != '\0'))
> thissize++;
> (using MAX just in case there is already some extra padding in the length or
> whatever else).
Ah, well. Just FYI, this check in output_constant
if (size == 0 || flag_syntax_only)
return size;
prevents zero-padding of strings with STRING_LENGTH==0 && DECL_SIZE==0.
But due to the check in mergeable_string_section
&& (len = int_size_in_bytes (TREE_TYPE (decl))) > 0
&& TREE_STRING_LENGTH (decl) == len)
we should not get size==0 or thissize == 0 in a merge_strings section.
So it should not make a difference what happens with thissize==0.
More information about the Gcc-bugs
mailing list