https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108988
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 54569 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54569&action=edit gcc13-pr108988.patch Untested fix. In this function len is already checked to be INTEGER_CST, so just fold_convert is sufficient. Went through the whole gimple-fold.cc and all other values computed by c_strlen or get_maxval_strlen etc. are properly folded to size_type_node when needed.