This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] print full STRING_CST in Gimple dumps (PR 87052)
On Thu, 23 Aug 2018, Richard Biener wrote:
> > > Can you write a not \0 terminated string literal in C?
> > Yes: char a = "12";
> I thought they are fully defined in translation phase #1 ...
No, you can't write a string literal which is not zero terminated, because
in translation phase 7 a zero code is appended to all character sequences
resulting from string literals, which is then used to allocate and
initialize a static (wide) character array of just the right size,
including the zero code.
The above construct uses that static char array from the string literal
to initialize a char array (which is explicitely allowed), and _that_
one is not zero terminated. But it's also no string literal.
(Of course, due to as-if the intermediate char array won't usually be