std::stringbuf::seekoff return wrong position value. solution: patch: --- include/bits/sstream.tcc.orig 2004-08-10 17:11:28.000000000 +0800 +++ include/bits/sstream.tcc 2004-08-10 17:11:59.000000000 +0800 @@ -160,14 +160,14 @@ && this->egptr() - __beg >= __newoffi + __off) { this->gbump((__beg + __newoffi + __off) - this->gptr()); - __ret = pos_type(__newoffi); + __ret = pos_type(__newoffi + __off); } if ((__testout || __testboth) && __newoffo + __off >= 0 && this->egptr() - __beg >= __newoffo + __off) { this->pbump((__beg + __newoffo + __off) - this->pptr()); - __ret = pos_type(__newoffo); + __ret = pos_type(__newoffo + __off); } } return __ret;
*** Bug 16957 has been marked as a duplicate of this bug. ***
*** Bug 16958 has been marked as a duplicate of this bug. ***
Subject: Bug 16956 CVSROOT: /cvs/gcc Module name: gcc Changes by: paolo@gcc.gnu.org 2004-08-12 22:26:33 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/include/bits: sstream.tcc libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char: 1.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t: 1.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char: 1.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t: 1.cc Added files: libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char: 16956.cc libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t: 16956.cc Log message: 2004-08-12 Paolo Carlini <pcarlini@suse.de> PR libstdc++/16956 * include/bits/sstream.tcc (basic_stringbuf<>::seekoff): Add __off to the returned value, reorganize a bit. * testsuite/27_io/basic_stringbuf/seekoff/char/16956.cc: New. * testsuite/27_io/basic_stringbuf/seekoff/wchar_t/16956.cc: New. * testsuite/27_io/basic_stringbuf/seekoff/char/1.cc: Remove junk. * testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc: Likewise. * testsuite/27_io/basic_stringbuf/seekpos/char/1.cc: Likewise. * testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2609&r2=1.2610 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/sstream.tcc.diff?cvsroot=gcc&r1=1.40&r2=1.41 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/16956.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/char/1.cc.diff?cvsroot=gcc&r1=1.3&r2=1.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/16956.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekoff/wchar_t/1.cc.diff?cvsroot=gcc&r1=1.1&r2=1.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/char/1.cc.diff?cvsroot=gcc&r1=1.3&r2=1.4 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/27_io/basic_stringbuf/seekpos/wchar_t/1.cc.diff?cvsroot=gcc&r1=1.1&r2=1.2
Fixed for 4.0. The deep behavior change is not suited for a dot-release.