public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kennytm at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/53690] New: \u0000 and \U00000000 are wrong encoded as U+0001.
Date: Fri, 15 Jun 2012 19:42:00 -0000	[thread overview]
Message-ID: <bug-53690-4@http.gcc.gnu.org/bugzilla/> (raw)

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)


             reply	other threads:[~2012-06-15 19:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-15 19:42 kennytm at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53690-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).