GCC accepts the following with -ansi -pedantic -Wall without diagnostics

#include <stdlib.h>
wchar_t z[] = L"a" "\xff";

GCC claims a default execution charset of UTF-8; presumably the default
execution wide character set is UTF-32.  But "\xff" is a two-character narrow
execution character set string literal, with characters \xff \0, which is
invalid UTF-8 and so cannot be converted in a meaningful way to the execution
character set (whatever it is).

I would expect the above code to be rejected, or at least diagnosed.


-- 
           Summary: Dubious charset conversions
           Product: gcc
           Version: 4.1.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: neil at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35908

Reply via email to