This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
libstdc++/10478: stdio_filebuf corrupts output for buffer sizes 1,2,3The
- From: Hans dot Ranke at ei dot tum dot de
- To: gcc-gnats at gcc dot gnu dot org
- Date: 24 Apr 2003 09:59:01 -0000
- Subject: libstdc++/10478: stdio_filebuf corrupts output for buffer sizes 1,2,3The
- Reply-to: Hans dot Ranke at ei dot tum dot de
>Number: 10478
>Category: libstdc++
>Synopsis: stdio_filebuf corrupts output for buffer sizes 1,2,3The
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Apr 24 10:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Hans Ranke <Hans dot Ranke at ei dot tum dot de>
>Release: 3.2.2
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
The __gnu_cxx::stdio_filebuf has an optional argument for the
desired buffer size. However, if __size is set to 1, 2, or 3,
only every (__size+1)th character will be written out.
>How-To-Repeat:
See attached file.
The program is supposed to output a constant string, followed by the buffer size, for the buffer sizes 0 .. 5 to the file "testout".
I get the following output:
abcdefghijklmnopqrstuvwxyz 0
bdfhjlnprtvxz 1
cfilorux 2
dhlptx 3
abcdefghijklmnopqrstuvwxyz 4
abcdefghijklmnopqrstuvwxyz 5
For the sizes 0, 4 and 5, the output is as expected, for 1, 2 and 3, only every 2nd, 3rd or 4th character is written.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="test1.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test1.cc"
dXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2luY2x1ZGUgPGZjbnRsLmg+CiNpbmNsdWRlIDxleHQvc3Rk
aW9fZmlsZWJ1Zi5oPgojaW5jbHVkZSA8aW9zdHJlYW0+CgoKaW50IG1haW4oaW50IGFyZ2MsIGNo
YXIgKiphcmd2KSB7CiAgICBpbnQgZmQgPSBvcGVuKCJ0ZXN0b3V0IiwgT19XUk9OTFkgfCBPX0NS
RUFUKTsKICAgIEZJTEUgKmNmaWxlID0gZmRvcGVuKGZkLCAidyIpOwogICAgc2V0YnVmKGNmaWxl
LCAoY2hhciAqKTApOyAvLyBzZXQgdG8gdW5idWZmZXJlZAoKICAgIGZvciAoaW50IGJ1ZnNpemUg
PSAwOyBidWZzaXplIDwgNjsgYnVmc2l6ZSsrKSB7CglfX2dudV9jeHg6OnN0ZGlvX2ZpbGVidWY8
Y2hhcj4qIGZpbGVfYnVmID0gCgluZXcgX19nbnVfY3h4OjpzdGRpb19maWxlYnVmPGNoYXI+KCBj
ZmlsZSwgaW9zX2Jhc2U6OmluIHwgaW9zX2Jhc2U6Om91dCwgYnVmc2l6ZSk7CiAgICAgICAgaW9z
dHJlYW0gKnN0cj0gbmV3IGlvc3RyZWFtKGZpbGVfYnVmKTsKCSpzdHIgPDwgImFiY2RlZmdoaWpr
bG1ub3BxcnN0dXZ3eHl6IjsKCWRlbGV0ZShzdHIpOwoJZGVsZXRlKGZpbGVfYnVmKTsKCWZwcmlu
dGYoY2ZpbGUsICIgJWRcbiIsIGJ1ZnNpemUpOwogICAgfQp9Cg==