Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
4.1.3, 4.1.4
-
None
Description
The program below should run successfully to completion but instead it aborts (both in 4.1.3 and on trunk):
$ cat t.cpp && make t && LD_LIBRARY_PATH=../lib ./t
#include <cassert>
#include <fstream>
#include <ios>
int main ()
{
struct: std::filebuf {
int_type overflow (int_type c)
} buf;
buf.open ("file", std::ios::out);
buf.pubsetbuf (0, 0);
buf.overflow (std::filebuf::traits_type::eof ());
buf.close ();
std::ifstream in ("file");
assert (std::istream::traits_type::eof () == in.get ());
}
gcc -c -I/amd/devco/sebor/stdcxx-4.1.3/include/ansi -D_RWSTDDEBUG -pthread -D_RWSTD_USE_CONFIG -I/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/include -I/amd/devco/sebor/stdcxx-4.1.3/include -I/amd/devco/sebor/stdcxx-4.1.3/examples/include -pedantic -nostdinc++ -g -m64 -Wall -W -Wcast-qual -Winline -Wshadow -Wwrite-strings -Wno-long-long -Wcast-align t.cpp
gcc t.o -o t -pthread -m64 -L/build/sebor/stdcxx-4.1.3-gcc-3.4.3_6-15D/lib -lstd15D -lsupc++ -lm
t: t.cpp:19: int main(): Assertion `std::istream::traits_type::eof () == in.get ()' failed.
Aborted
Attachments
Issue Links
- duplicates
-
STDCXX-204 std::filebuf::overflow(EOF) writes garbage in unbuffered mode
- Closed