public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
@ 2004-04-20 13:51 drkent at lanl dot gov
  2004-04-20 14:03 ` [Bug c++/15027] " drkent at lanl dot gov
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: drkent at lanl dot gov @ 2004-04-20 13:51 UTC (permalink / raw)
  To: gcc-bugs

The code listed below behaves differently when run with g++ 3.0.x and 3.3.3 on
x86 GNU Linux.  With 3.0.x and all earlier GCC compilers I've used, the >>
operator reads one word from the ifstream into temp.  With 3.3.3, the >>
operator reads the entire file into temp.  I have seen the same behavior as
3.3.3 also in the 3.2.3 and 3.2.1 compilers.  To the best of my knowledge, >>
should only read in one word (this is what all other C++ compilers I've used do).

g++ -v gives:
Reading specs from
/users/drkent/code/gcc/gcc_3.3.3/lib/gcc-lib/i686-pc-linux-gnu/3.3.3/specs
Configured with: ./configure --prefix=/users/drkent/code/gcc/gcc_3.3.3
--disable-threads
Thread model: single
gcc version 3.3.3

I have also tried this using the posix threading.


uname -a gives:
Linux l1 2.4.18 #1 SMP Mon Nov 4 11:09:23 MST 2002 i686 unknown


// CODE START

#include <fstream>
#include <iostream>
#include <string>

using namespace std;

int main(int argc, char **argv)
{
  ofstream data("data_ifstream.dat");
  
  for(int i=0; i<10; i++)
    {
      data << i << endl;
    }

  data.close();

  ifstream file("data_ifstream.dat");

  string temp;

  file >> temp;

  cout << "Output should be \"0\" during a correct run:" << endl;
  cout << temp << endl;
}

-- 
           Summary: Inconsistent ifstream behavior between g++ 3.0.x and
                    3.3.3 on x86/Linux
           Product: gcc
           Version: 3.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: drkent at lanl dot gov
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/15027] Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
  2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
  2004-04-20 14:03 ` [Bug c++/15027] " drkent at lanl dot gov
@ 2004-04-20 14:03 ` drkent at lanl dot gov
  2004-04-20 14:15 ` drkent at lanl dot gov
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: drkent at lanl dot gov @ 2004-04-20 14:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drkent at lanl dot gov  2004-04-20 13:50 -------
Created an attachment (id=6121)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6121&action=view)
command line output from: g++ -v -save-temps -o test_ifstream.x
test_ifstream.cpp -static

command line output from: g++ -v -save-temps -o test_ifstream.x
test_ifstream.cpp -static

-- 


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


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

* [Bug c++/15027] Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
  2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
@ 2004-04-20 14:03 ` drkent at lanl dot gov
  2004-04-20 14:03 ` drkent at lanl dot gov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: drkent at lanl dot gov @ 2004-04-20 14:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drkent at lanl dot gov  2004-04-20 13:50 -------
Created an attachment (id=6122)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6122&action=view)
Source code reproducing the problem.

Source code reproducing the problem.

-- 


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


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

* [Bug c++/15027] Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
  2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
  2004-04-20 14:03 ` [Bug c++/15027] " drkent at lanl dot gov
  2004-04-20 14:03 ` drkent at lanl dot gov
@ 2004-04-20 14:15 ` drkent at lanl dot gov
  2004-04-20 14:34 ` [Bug libstdc++/15027] " bangerth at dealii dot org
  2004-04-20 14:52 ` pcarlini at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: drkent at lanl dot gov @ 2004-04-20 14:15 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From drkent at lanl dot gov  2004-04-20 13:51 -------
Created an attachment (id=6123)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=6123&action=view)
.ii file produced by g++ 3.3.3

.ii file produced by g++ 3.3.3

-- 


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


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

* [Bug libstdc++/15027] Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
  2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
                   ` (2 preceding siblings ...)
  2004-04-20 14:15 ` drkent at lanl dot gov
@ 2004-04-20 14:34 ` bangerth at dealii dot org
  2004-04-20 14:52 ` pcarlini at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: bangerth at dealii dot org @ 2004-04-20 14:34 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++


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


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

* [Bug libstdc++/15027] Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux
  2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
                   ` (3 preceding siblings ...)
  2004-04-20 14:34 ` [Bug libstdc++/15027] " bangerth at dealii dot org
@ 2004-04-20 14:52 ` pcarlini at suse dot de
  4 siblings, 0 replies; 6+ messages in thread
From: pcarlini at suse dot de @ 2004-04-20 14:52 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pcarlini at suse dot de  2004-04-20 14:18 -------
Hi, your problem seems definitely due to an old, not supported glibc and I'm
closing it as a duplicate. In case you are actually experiencing it with glibc
2.3.x, just let me know.

*** This bug has been marked as a duplicate of 10074 ***

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


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


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

end of thread, other threads:[~2004-04-20 14:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-20 13:51 [Bug c++/15027] New: Inconsistent ifstream behavior between g++ 3.0.x and 3.3.3 on x86/Linux drkent at lanl dot gov
2004-04-20 14:03 ` [Bug c++/15027] " drkent at lanl dot gov
2004-04-20 14:03 ` drkent at lanl dot gov
2004-04-20 14:15 ` drkent at lanl dot gov
2004-04-20 14:34 ` [Bug libstdc++/15027] " bangerth at dealii dot org
2004-04-20 14:52 ` pcarlini at suse dot de

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).