public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sbn at tbricks dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/57213] New: failed formatted input overwrites output value
Date: Wed, 08 May 2013 15:50:00 -0000	[thread overview]
Message-ID: <bug-57213-4@http.gcc.gnu.org/bugzilla/> (raw)

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

             Bug #: 57213
           Summary: failed formatted input overwrites output value
    Classification: Unclassified
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sbn@tbricks.com


Hello!

Here is a small test:

#include <sstream>
#include <iostream>

int main()
{
    std::istringstream iss("-a");
    unsigned i = 12345;
    iss >> i;
    std::cout << i << std::endl;
    return 0;
}

When building it with latest GCC 4.8.1 (svn rev. 198709) on Solaris 10 I got
the following output:

$ /opt/gcc-4.8/bin/g++ -v -std=c++03 a.cpp
Using built-in specs.
COLLECT_GCC=/opt/gcc-4.8/bin/g++
COLLECT_LTO_WRAPPER=/opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/4.8.1/lto-wrapper
Target: i386-pc-solaris2.10
Configured with: /export/home/sbn/src/gcc-4.8/configure --prefix=/opt/gcc-4.8
--enable-languages=c,c++ --with-ld=/usr/ccs/bin/ld --without-gnu-ld
--with-gnu-as --with-as=/opt/csw/bin/gas
Thread model: posix
gcc version 4.8.1 20130508 (prerelease) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-std=c++98' '-shared-libgcc' '-mtune=generic'
'-march=pentium4'
 /opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/4.8.1/cc1plus -quiet -v a.cpp
-quiet -dumpbase a.cpp -mtune=generic -march=pentium4 -auxbase a -std=c++98
-version -o /var/tmp//ccqRQJAe.s
GNU C++ (GCC) version 4.8.1 20130508 (prerelease) (i386-pc-solaris2.10)
        compiled by GNU C version 4.8.1 20130508 (prerelease), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../../../i386-pc-solaris2.10/include"
#include "..." search starts here:
#include <...> search starts here:
 /opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../../../include/c++/4.8.1

/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../../../include/c++/4.8.1/i386-pc-solaris2.10

/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../../../include/c++/4.8.1/backward
 /opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/include
 /opt/gcc-4.8/include
 /opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.8.1 20130508 (prerelease) (i386-pc-solaris2.10)
        compiled by GNU C version 4.8.1 20130508 (prerelease), GMP version
4.3.2, MPFR version 2.4.2, MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: c518101980ab073fe5c4f884a6f42b1b
COLLECT_GCC_OPTIONS='-v' '-std=c++98' '-shared-libgcc' '-mtune=generic'
'-march=pentium4'
 /opt/csw/bin/gas -v -V -Qy -s --32 -o /var/tmp//ccOebkCA.o
/var/tmp//ccqRQJAe.s
GNU assembler version 2.23.1 (i386-pc-solaris2.10) using BFD version (GNU
Binutils) 2.23.1
COMPILER_PATH=/opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/4.8.1/:/opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/4.8.1/:/opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/:/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/:/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/:/usr/ccs/bin/
LIBRARY_PATH=/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/:/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-v' '-std=c++98' '-shared-libgcc' '-mtune=generic'
'-march=pentium4'
 /opt/gcc-4.8/libexec/gcc/i386-pc-solaris2.10/4.8.1/collect2 -V -Y
P,/usr/ccs/lib:/lib:/usr/lib -Qy /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/values-Xa.o /opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/crtbegin.o
-L/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1
-L/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/../../.. /var/tmp//ccOebkCA.o
-lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/opt/gcc-4.8/lib/gcc/i386-pc-solaris2.10/4.8.1/crtend.o /usr/lib/crtn.o
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.1509
$ LD_LIBRARY_PATH=/opt/gcc-4.8/lib ./a.out 
0
$ uname -a
SunOS node8 5.10 Generic_147441-16 i86pc i386 i86pc

But I expect it to return 12345 (and it's in fact the case if I use GCC 3.4.3
shipped with Solaris 10 SFW)

In C++ standard (C++03) I can see 22.2.2.1.2p1 [lib.facet.num.get.virtuals]:
"If an error occurs, val is unchanged; otherwise it is set to the resulting
value."


             reply	other threads:[~2013-05-08 15:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-08 15:50 sbn at tbricks dot com [this message]
2013-05-08 16:01 ` [Bug libstdc++/57213] " redi at gcc dot gnu.org
2013-05-09  7:34 ` sbn at tbricks dot com
2013-05-09  8:06 ` redi at gcc dot gnu.org
2013-05-09  8:12 ` sbn at tbricks 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-57213-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).