public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/10478: stdio_filebuf corrupts output for buffer sizes 1,2,3The
@ 2003-04-24 11:39 paolo
0 siblings, 0 replies; 2+ messages in thread
From: paolo @ 2003-04-24 11:39 UTC (permalink / raw)
To: Hans.Ranke, gcc-bugs, gcc-prs, nobody
Synopsis: stdio_filebuf corrupts output for buffer sizes 1,2,3The
State-Changed-From-To: open->closed
State-Changed-By: paolo
State-Changed-When: Thu Apr 24 11:39:22 2003
State-Changed-Why:
Already fixed for the forthcoming 3.3 release with:
2003-03-31 Paolo Carlini <pcarlini@unitus.it>
* include/ext/stdio_filebuf.h
(stdio_filebuf::stdio_filebuf(int, openmode, bool, size_t),
stdio_filebuf::stdio_filebuf(__c_file*, openmode, size_t):
_M_buf_size_opt == 0 means only "not to use an allocated buffer"
since a stack-based buffer is used for small values of the size_t
parameter.
* include/bits/fstream.tcc (basic_filebuf::_M_really_overflow).
If _M_buf_size != 0 flush out the buffer (any kind, stack-based too).
* testsuite/ext/stdio_filebuf_2.cc: New testfile.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10478
^ permalink raw reply [flat|nested] 2+ messages in thread
* libstdc++/10478: stdio_filebuf corrupts output for buffer sizes 1,2,3The
@ 2003-04-24 10:06 Hans.Ranke
0 siblings, 0 replies; 2+ messages in thread
From: Hans.Ranke @ 2003-04-24 10:06 UTC (permalink / raw)
To: gcc-gnats
>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.Ranke@ei.tum.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==
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-04-24 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-24 11:39 libstdc++/10478: stdio_filebuf corrupts output for buffer sizes 1,2,3The paolo
-- strict thread matches above, loose matches on Subject: below --
2003-04-24 10:06 Hans.Ranke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).