Bug 54820 - seekp moves backward, but not forward, in ostrstream
seekp moves backward, but not forward, in ostrstream
Status: CLOSED CURRENTRELEASE
Product: Red Hat Linux
Classification: Retired
Component: libstdc++ (Show other bugs)
7.1
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2001-10-19 14:54 EDT by davidwriter
Modified: 2008-05-01 11:38 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-12-15 12:57:35 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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

  None (edit)
Description davidwriter 2001-10-19 14:54:29 EDT
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 14:56:45 EDT
Created attachment 34423 [details]
C++ file testing seekp
Comment 2 Mike A. Harris 2001-11-24 20:51:05 EST
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 12:46:44 EST
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 12:48:21 EST
Created attachment 42331 [details]
C++ standard version of the example code, working fine
Comment 5 Alan Cox 2002-12-15 12:57:35 EST
Ok in 3.2

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