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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 60751
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60751&action=edit
gcc15-pr119278.patch

Untested fix.  The STRING_CST case looks wrong to me, STRING_CSTs certainly
can have embedded zeros and strcmp will compare only up to the first '\0'.
Now, for STRING_CST, most likely TREE_STRING_LENGTH should be the same if the
types are the same because type of a STRING_CST is usually ARRAY_TYPE with some
INTEGER_TYPE element type and the array extent should match TREE_STRING_LENGTH.
So, the comparison is there just in case, perhaps gcc_assert would work too.
While for RAW_DATA_CST, type is the type of each element, so say
char_type_node,
and so comparing length is essential.

Reply via email to