On Mon, 30 Jul 2018, Bernd Edlinger wrote: > Hi, > > this is how I would like to handle the over length strings issue in the C FE. > If the string constant is exactly the right length and ends in one explicit > NUL character, shorten it by one character.
I don't think shortening should be limited to that case. I think the case where the constant is longer than that (and so gets an unconditional pedwarn) should also have it shortened - any constant that doesn't fit in the object being initialized should be shortened to fit, whether diagnosed or not, we should define GENERIC / GIMPLE to disallow too-large string constants in initializers, and should add an assertion somewhere in the middle-end that no too-large string constants reach it. -- Joseph S. Myers jos...@codesourcery.com