This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] print full STRING_CST in Gimple dumps (PR 87052)
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Martin Sebor <msebor at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 22 Aug 2018 14:48:04 +0200
- Subject: Re: [PATCH] print full STRING_CST in Gimple dumps (PR 87052)
- References: <email@example.com>
On Wed, Aug 22, 2018 at 4:56 AM Martin Sebor <firstname.lastname@example.org> wrote:
> In the discussion of the fallout from the enhancement for pr71625
> it was pointed out that STRING_CSts in Gimple dumps extend only
> to the first nul and don't include any subsequent characters,
> and that this makes the dumps harder to read and might give rise
> to the question whether the code is correct.
> In the attached patch I enhance the pretty_print_string() function
> to print the full contents of a STRING_CST, including any embedded
> nuls to make the dumps clearer. I got rid of the single digit
> escapes like '\1' since they make the string look ambiguous.
> If TREE_STRING_LENGTH (node) is guaranteed to be non-zero these
> days the test for it being so may be redundant but I figured it's
> better to be safe than sorry.
> A further enhancement might be to also distinguish the type of
> the STRING_CST.
And somehow indicate whether it is \0 terminated (just thinking of
the GIMPLE FE and how it parses string literals simply by relying
Can you write a not \0 terminated string literal in C?
The patch is OK.