This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] print full STRING_CST in Gimple dumps (PR 87052)

On Wed, Aug 22, 2018 at 4:56 AM Martin Sebor <> 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

And somehow indicate whether it is \0 terminated (just thinking of
the GIMPLE FE and how it parses string literals simply by relying
on libcpp).

Can you write a not \0 terminated string literal in C?

The patch is OK.


> Martin

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]