re PR libstdc++/6414 (g++ 3.1 tellg() regression within last week)
authorJason Merrill <jason@redhat.com>
Tue, 23 Apr 2002 21:01:22 +0000 (17:01 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 23 Apr 2002 21:01:22 +0000 (17:01 -0400)
        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.

From-SVN: r52679

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fstream.tcc
libstdc++-v3/testsuite/27_io/istream_seeks.cc

index b69477bd01e530f4f48cf013a33c9ff6b9c1adb0..c3667b9c7dda7dae4c256daeb1780cb7d0fd227e 100644 (file)
@@ -1,3 +1,11 @@
+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.
+
 2002-04-23  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * config/cpu/mmix/bits/cpu_limits.h: New file.
index 235b4a83fd386859304f0ba972a5ef2f1bb9b369..c530f34794b468d440625d8dd35739dc5395c8c5 100644 (file)
@@ -567,7 +567,7 @@ namespace std
          else
            {
              __ret = _M_file.seekoff(__off, ios_base::cur, __mode);
-             __ret += max(_M_out_cur, _M_in_cur) - _M_buf;
+             __ret += _M_in_cur - _M_filepos;
            }
        }
       _M_last_overflowed = false;      
index dac5f3cf9eb62418d79af8cdde94231fc28bbb46..6574b0a059b6ce372bb78cf4c50c5eb782157ece 100644 (file)
@@ -229,7 +229,14 @@ void test04(void)
   VERIFY( pos05 == pos06 + off_type(10) );
   VERIFY( state01 == state02 );
   pos06 = is03.tellg(); 
-  VERIFY( pos05 == pos06 ); 
+  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);