public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/6414: g++ 3.1 tellg() regression within last week
@ 2002-04-23  5:32 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-04-23  5:32 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, nobody, snyder

Synopsis: g++ 3.1 tellg() regression within last week

Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-By: jason
Responsible-Changed-When: Tue Apr 23 05:32:03 2002
Responsible-Changed-Why:
    my bug

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6414


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

* Re: libstdc++/6414: g++ 3.1 tellg() regression within last week
@ 2002-04-23 15:00 jason
  0 siblings, 0 replies; 5+ messages in thread
From: jason @ 2002-04-23 15:00 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jason, snyder

Synopsis: g++ 3.1 tellg() regression within last week

State-Changed-From-To: analyzed->closed
State-Changed-By: jason
State-Changed-When: Tue Apr 23 15:00:30 2002
State-Changed-Why:
    Fixed.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6414


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

* Re: libstdc++/6414: g++ 3.1 tellg() regression within last week
@ 2002-04-23  6:06 Jason Merrill
  0 siblings, 0 replies; 5+ messages in thread
From: Jason Merrill @ 2002-04-23  6:06 UTC (permalink / raw)
  To: jason; +Cc: gcc-prs

The following reply was made to PR libstdc++/6414; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: libstdc++@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/6414: g++ 3.1 tellg() regression within last week
Date: Tue, 23 Apr 2002 14:00:44 +0100

 --=-=-=
 
 Missed a spot.  Testing now; I'll apply it to trunk and branch if it passes.
 
 2002-04-23  Jason Merrill  <jason@redhat.com>
 
 	PR libstdc++/6414
 	* include/bits/fstream.tcc (basic_filebuf::seekoff): Adjust return
 	value properly in the trivial case.
 	* testsuite/27_io/istream_seeks.cc (test04): Make sure that
 	tellg() returns the right value after a read.
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline
 
 Index: include/bits/fstream.tcc
 ===================================================================
 RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/fstream.tcc,v
 retrieving revision 1.30
 diff -c -p -r1.30 fstream.tcc
 *** include/bits/fstream.tcc	22 Apr 2002 20:28:04 -0000	1.30
 --- include/bits/fstream.tcc	23 Apr 2002 12:55:24 -0000
 *************** namespace std
 *** 567,573 ****
   	  else
   	    {
   	      __ret = _M_file.seekoff(__off, ios_base::cur, __mode);
 ! 	      __ret += max(_M_out_cur, _M_in_cur) - _M_buf;
   	    }
   	}
         _M_last_overflowed = false;	
 --- 567,573 ----
   	  else
   	    {
   	      __ret = _M_file.seekoff(__off, ios_base::cur, __mode);
 ! 	      __ret += _M_in_cur - _M_filepos;
   	    }
   	}
         _M_last_overflowed = false;	
 Index: testsuite/27_io/istream_seeks.cc
 ===================================================================
 RCS file: /cvs/gcc/gcc/libstdc++-v3/testsuite/27_io/istream_seeks.cc,v
 retrieving revision 1.10
 diff -c -p -r1.10 istream_seeks.cc
 *** testsuite/27_io/istream_seeks.cc	7 Aug 2001 03:38:33 -0000	1.10
 --- testsuite/27_io/istream_seeks.cc	23 Apr 2002 12:55:25 -0000
 *************** void test04(void)
 *** 229,235 ****
     VERIFY( pos05 == pos06 + off_type(10) );
     VERIFY( state01 == state02 );
     pos06 = is03.tellg(); 
 !   VERIFY( pos05 == pos06 ); 
   
   #ifdef DEBUG_ASSERT
     assert(test);
 --- 229,242 ----
     VERIFY( pos05 == pos06 + off_type(10) );
     VERIFY( state01 == state02 );
     pos06 = is03.tellg(); 
 !   VERIFY( pos05 == pos06 );
 ! 
 !   // libstdc++/6414
 !   if01.seekg(0, std::ios_base::beg);
 !   pos01 = if01.tellg();
 !   if01.peek();
 !   pos02 = if01.tellg();
 !   VERIFY( pos02 == pos01 );
   
   #ifdef DEBUG_ASSERT
     assert(test);
 
 --=-=-=--


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

* Re: libstdc++/6414: g++ 3.1 tellg() regression within last week
@ 2002-04-22 22:56 ljrittle
  0 siblings, 0 replies; 5+ messages in thread
From: ljrittle @ 2002-04-22 22:56 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, snyder

Synopsis: g++ 3.1 tellg() regression within last week

State-Changed-From-To: open->analyzed
State-Changed-By: ljrittle
State-Changed-When: Mon Apr 22 22:56:01 2002
State-Changed-Why:
    I can confirm that this was introduced with the fix
    to libstdc++/4150.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6414


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

* libstdc++/6414: g++ 3.1 tellg() regression within last week
@ 2002-04-22 20:16 snyder
  0 siblings, 0 replies; 5+ messages in thread
From: snyder @ 2002-04-22 20:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6414
>Category:       libstdc++
>Synopsis:       g++ 3.1 tellg() regression within last week
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 22 20:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     scott snyder
>Release:        3.1 20020422 (prerelease)
>Organization:
>Environment:
System: Linux karma 2.4.9-13 #1 Tue Oct 30 20:11:04 EST 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../egcs/configure --prefix=/usr/local/egcs --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77
>Description:


After the input stream changes of the last week, tellg() no longer
works correctly.  It seems to be returning the raw file position,
not taking into account the buffering that libstdc++ does.

This seems to happen only if tellg() is called after a read.
If a seek intervenes between the read and the tellg(), then the
return from tellg() is as expected (consistent with the above, since
libstd++ won't have anything buffered at that point).

Here's the output i get from the example below:

$ g++ -o x x.cc
$ ./x
0
177
$ wc x.cc
     11      26     176 x.cc
$

I expect the second offset printed to be `1'.

This worked ok with the 3.1 branch as of about apr 15, so it looks
like this was introduced during the past week.

sss



>How-To-Repeat:

- x.cc -------------------------------------------------------------------
#include <iostream>
#include <fstream>

int main ()
{
  std::ifstream s ("x.cc");
  std::cout << s.tellg() << "\n";
  s.get ();
  std::cout << s.tellg() << "\n";
  return 0;
}
--------------------------------------------------------------------------


>Fix:
	
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-04-23 22:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-23  5:32 libstdc++/6414: g++ 3.1 tellg() regression within last week jason
  -- strict thread matches above, loose matches on Subject: below --
2002-04-23 15:00 jason
2002-04-23  6:06 Jason Merrill
2002-04-22 22:56 ljrittle
2002-04-22 20:16 snyder

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