[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 16:20:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89490

--- Comment #11 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
I agree, that it would be better to not put any
mergeable things in a block object.  If section anchors
are ever used on a string constant, it is going to fail.

A constant with size = 0 is possible, for instance
in Ada an empty string really empty.  These should not
go into mergeable sections.  output_constant
ignores the merge_strings parameter, therefore
I would not assume there is a zero termination


Instead of:

              if (thissize == 0
                  || TREE_STRING_POINTER (str) [thissize - 1] != '\0')
                size = MAX (size, thissize + 1);

maybe:

              if (thissize != 0
                  && TREE_STRING_POINTER (str) [thissize - 1] != '\0')
                size = MAX (size, thissize + 1);


More information about the Gcc-bugs mailing list