public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/53690] New: \u0000 and \U00000000 are wrong encoded as U+0001.
@ 2012-06-15 19:42 kennytm at gmail dot com
  2012-06-15 20:48 ` [Bug c++/53690] [C++11] \u0000 and \U00000000 are wrongly " redi at gcc dot gnu.org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: kennytm at gmail dot com @ 2012-06-15 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53690
           Summary: \u0000 and \U00000000 are wrong encoded as U+0001.
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kennytm@gmail.com


Tested with gcc 4.7 and 4.5 (via ideone)

~~~~~~~~~~~

#include <cstdint>
#include <cstdio>

int main() {
    uint32_t a = U'\U00000000';
    uint32_t b = U'\u0000';
    uint32_t c = U'\x00';
    uint32_t d = U'\0';

    uint16_t e = u'\U00000000';
    uint16_t f = u'\u0000';
    uint16_t g = u'\x00';
    uint16_t h = u'\0';

    printf("%x %x %x %x %x %x %x %x\n", a, b, c, d, e, f, g, h);

    return 0;
}

// Compile with:
//
// g++ -std=c++11 x.cpp

~~~~~~~~~~~

This program prints "1 1 0 0 1 1 0 0", but the expected output should be "0 0 0
0 0 0 0 0".



gcc -v:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.7.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/src/gcc-4.7-20120505/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch
--enable-libstdcxx-time --enable-gnu-unique-object --enable-linker-build-id
--with-ppl --enable-cloog-backend=isl --enable-lto --enable-gold
--enable-ld=default --enable-plugin --with-plugin-ld=ld.gold
--with-linker-hash-style=gnu --enable-multilib --disable-libssp
--disable-build-with-cxx --disable-build-poststage1-with-cxx
--enable-checking=release --with-fpmath=sse
Thread model: posix
gcc version 4.7.0 20120505 (prerelease) (GCC)


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-07-02 18:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-15 19:42 [Bug c++/53690] New: \u0000 and \U00000000 are wrong encoded as U+0001 kennytm at gmail dot com
2012-06-15 20:48 ` [Bug c++/53690] [C++11] \u0000 and \U00000000 are wrongly " redi at gcc dot gnu.org
2012-07-08 11:59 ` schwab@linux-m68k.org
2012-07-08 20:23 ` steven at gcc dot gnu.org
2012-07-08 20:53 ` [Bug preprocessor/53690] " steven at gcc dot gnu.org
2012-07-08 21:44 ` redi at gcc dot gnu.org
2012-07-08 21:59 ` steven at gcc dot gnu.org
2015-04-30 10:37 ` paolo.carlini at oracle dot com
2015-06-21 17:23 ` wjl at icecavern dot net
2015-07-01 18:40 ` paolo.carlini at oracle dot com
2015-07-02 18:55 ` paolo at gcc dot gnu.org
2015-07-02 18:57 ` paolo.carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).