https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128330
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |rguenth at gcc dot gnu.org
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I'll note that the char_type_node handling is on purpose to allow
inter-operation of -fsigned-char and -funsigned-char (and different languages
char signedness) TUs. But that obviously breaks literal comparisons with
char_type_node. Those should not happen after IPA. I believe
if (t == char_type_node
|| t == signed_char_type_node
|| t == unsigned_char_type_node)
should better be
if (INTEGRAL_TYPE_P (t)
&& tree_fits_uhwi_p (TYPE_SIZE (t))
&& tree_to_uhwi (TYPE_SIZE (t)) == CHAR_TYPE_SIZE)
I believe the original check would fail to catch
uint8_t b[64];
Of course I have no idea why anybody would care for large/small char array vs.
array ...
If it's really important to know whether an array is a string we have
TYPE_STRING_FLAG that frontends could set (that's IIRC mostly used for
debug info though). So eventually adding || TYPE_STRING_FLAG (type)
works as well.