https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71996

            Bug ID: 71996
           Summary: -fdump-translation-unit fails to dump string literals
                    of type char16_t/char32_t/wchar_t
           Product: gcc
           Version: 6.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.r.longbons at gmail dot com
  Target Milestone: ---

$ cat dump.c
#include <wchar.h>
#include <uchar.h>

char string1[] = "1string";
wchar_t string2[] = L"2string";
char16_t string3[] = u"3string";
char32_t string4[] = U"4string";

# Output for a little-endian host.
$ gcc dump.c -fdump-translation-unit=stdout -c -o /dev/null | grep string_cst
@2810   string_cst       type: @2808   strg: 1string  lngt: 8       
@2823   string_cst       type: @2821   strg: 2        lngt: 32      
@2831   string_cst       type: @2829   strg: 3        lngt: 16      
@2837   string_cst       type: @2836   strg: 4        lngt: 32      

###

Some decisions also should be made about what exactly lngt should mean (bytes
or characters) - and what to do about string values that contain embedded
newlines, nonprintable characters, or NULs.

Personally, I would prefer the strings to be escaped all the way to something
similar to the input, including the L"" - and the lngt moved before it, if not
removed entirely.

Reply via email to