This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure
- From: "jakethompson1 at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Nov 2009 04:17:26 -0000
- Subject: [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i586
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.0 20090506 (Red Hat 4.4.0-4) (GCC)
libstdc++ v4.4.0 (6.0.11).
cin >> y overwrites y and set failbit if there is no double on the stream:
#include <iostream>
#include <sstream>
using namespace std;
int main ()
{
stringstream s ("hello");
stringstream t ("hello");
int x = 1;
double y = 1.0;
// these fail, do x/y get overwritten?
s >> x;
t >> y;
cout << "x=" << x << " y=" << y << endl;
}
with g++ 4.4.0 libstdc++ 6.0.11 this produces:
x=1 y=0
with g++ 4.1.2 libstdc++ 6.0.8 this produces:
x=1 y=1
--
Summary: operator>>(istream &, double &) overwrites value upon
failure
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakethompson1 at gmail dot com
GCC build triplet: x86_64-redhat-linux
GCC host triplet: x86_64-redhat-linux
GCC target triplet: x86_64-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42191