Bug 54820 - seekp moves backward, but not forward, in ostrstream
Summary: seekp moves backward, but not forward, in ostrstream
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: libstdc++
Version: 7.1
Hardware: i686
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-10-19 18:54 UTC by davidwriter
Modified: 2008-05-01 15:38 UTC (History)
1 user (show)

(edit)
Clone Of:
(edit)
Last Closed: 2002-12-15 17:57:35 UTC


Attachments (Terms of Use)
C++ file testing seekp (968 bytes, text/plain)
2001-10-19 18:56 UTC, davidwriter
no flags Details
C++ standard version of the example code, working fine (1.00 KB, text/plain)
2002-01-12 17:48 UTC, Michael Schwendt
no flags Details

Description davidwriter 2001-10-19 18:54:29 UTC
Description of Problem:


Version-Release number of selected component (if applicable):
g++ 2.96-85

How Reproducible:
Every time

Steps to Reproduce:
1.  Compile program with g++ -Wall  testseek.cpp -o testseek
2. Run
3. 

Actual Results:seekp test
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 100
 Bad bit set
Posn after 3rd move : 0

Expected
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 300
Posn after 3rd move : 0

 Results:
Legacy code fails as seekp is not working

Additional Information:

Comment 1 davidwriter 2001-10-19 18:56:45 UTC
Created attachment 34423 [details]
C++ file testing seekp

Comment 2 Mike A. Harris 2001-11-25 01:51:05 UTC
David, as I mentioned on enigma-list, I don't personally know 
C++ to know wether or not this is a bug, however, I have
just confirmed the results above if that helps:

pts/16 mharris@zod:~$ ./testseek
seekp test
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 100
 Bad bit set
Posn after 3rd move : 0
pts/16 mharris@zod:~$ rpm -qf /usr/bin/g++
gcc-c++-2.96-95


pts/0 mharris@halden:~$ ./testseek
seekp test
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 100
 Bad bit set
Posn after 3rd move : 0
pts/0 mharris@halden:~$ cat /etc/redhat-release
Red Hat Linux release 7.2 (Enigma)
pts/0 mharris@halden:~$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-98)

Hope this helps.

Comment 3 Michael Schwendt 2002-01-12 17:46:44 UTC
Converting from non-standard "ostrstream" to standard "ostringstream" (header
<sstream>) yields expected behaviour:

$ rpm -q gcc-c++
gcc-c++-2.96-98

$ ./testseek2
seekp test2
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 300
Posn after 3rd move : 0


Or, using GCC3 and libstdc++ v3 yields expected behaviour in both cases, too:

$ rpm -q gcc3-c++
gcc3-c++-3.0.1-3

$ ./testseek
seekp test
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 300
Posn after 3rd move : 0

$ ./testseek2
seekp test2
Posn after 1st write : 1020
Posn after 1st move : 100
Posn after 2nd move : 300
Posn after 3rd move : 0


Comment 4 Michael Schwendt 2002-01-12 17:48:21 UTC
Created attachment 42331 [details]
C++ standard version of the example code, working fine

Comment 5 Alan Cox 2002-12-15 17:57:35 UTC
Ok in 3.2



Note You need to log in before you can comment on or make changes to this bug.