https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87854
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I wonder if we shouldn't change the c/, cp/ and c-family/ dirs to use c_build_string instead of build_string, where c_build_string would error if the length of the string literal is larger than TYPE_MAX_VALUE of c_common_signed_type (sizetype) and truncate the string literals to that length, similarly how we reject too large arrays: error_at (loc, "size of array %qE is too large", name); so size of string literal is too large or something similar. Or add such checking later on. Disadvantage of doing it in build_string wrapper is that we don't have a location_t in that spot. So perhaps lex_string/cp_parser_string_literal instead and have some helper function that will do the checking and truncate the already created STRING_CST?