public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/42191]  New: operator>>(istream &, double &) overwrites value upon failure
@ 2009-11-27  4:17 jakethompson1 at gmail dot com
  2009-11-27 10:04 ` [Bug libstdc++/42191] " redi at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakethompson1 at gmail dot com @ 2009-11-27  4:17 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug libstdc++/42191] operator>>(istream &, double &) overwrites value upon failure
  2009-11-27  4:17 [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure jakethompson1 at gmail dot com
@ 2009-11-27 10:04 ` redi at gcc dot gnu dot org
  2009-11-27 10:24 ` paolo dot carlini at oracle dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-11-27 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from redi at gcc dot gnu dot org  2009-11-27 10:04 -------
I think this change is intentional, as per the resolutions to 
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#696
and
http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#23


-- 


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


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

* [Bug libstdc++/42191] operator>>(istream &, double &) overwrites value upon failure
  2009-11-27  4:17 [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure jakethompson1 at gmail dot com
  2009-11-27 10:04 ` [Bug libstdc++/42191] " redi at gcc dot gnu dot org
@ 2009-11-27 10:24 ` paolo dot carlini at oracle dot com
  2009-11-27 10:46 ` redi at gcc dot gnu dot org
  2009-11-27 10:51 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-11-27 10:24 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from paolo dot carlini at oracle dot com  2009-11-27 10:24 -------
Definitely intentional, yes.


-- 

paolo dot carlini at oracle dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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

* [Bug libstdc++/42191] operator>>(istream &, double &) overwrites value upon failure
  2009-11-27  4:17 [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure jakethompson1 at gmail dot com
  2009-11-27 10:04 ` [Bug libstdc++/42191] " redi at gcc dot gnu dot org
  2009-11-27 10:24 ` paolo dot carlini at oracle dot com
@ 2009-11-27 10:46 ` redi at gcc dot gnu dot org
  2009-11-27 10:51 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu dot org @ 2009-11-27 10:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from redi at gcc dot gnu dot org  2009-11-27 10:46 -------
Paolo, should int x also be set to zero?


-- 


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


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

* [Bug libstdc++/42191] operator>>(istream &, double &) overwrites value upon failure
  2009-11-27  4:17 [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure jakethompson1 at gmail dot com
                   ` (2 preceding siblings ...)
  2009-11-27 10:46 ` redi at gcc dot gnu dot org
@ 2009-11-27 10:51 ` paolo dot carlini at oracle dot com
  3 siblings, 0 replies; 5+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-11-27 10:51 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from paolo dot carlini at oracle dot com  2009-11-27 10:50 -------
It is zero, in mainline. I'm not planning to backport anything here.


-- 


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


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

end of thread, other threads:[~2009-11-27 10:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-27  4:17 [Bug libstdc++/42191] New: operator>>(istream &, double &) overwrites value upon failure jakethompson1 at gmail dot com
2009-11-27 10:04 ` [Bug libstdc++/42191] " redi at gcc dot gnu dot org
2009-11-27 10:24 ` paolo dot carlini at oracle dot com
2009-11-27 10:46 ` redi at gcc dot gnu dot org
2009-11-27 10:51 ` paolo dot 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).