Hello,
I am trying to port the testsuite to an embedded environment.
I have gotten all of the needed tests to compile, and am debugging
those test that fail at runtime now.
\ext\stdio_filebuf\char\10063-1.cc fails.
The area it fails in is in the test1() rountine at:
{
__gnu_cxx::stdio_filebuf<char> sbuf(file, ios_base::out);
sbuf.sputc('2');
sbuf.sputc('3');
}
This code does not affect the output file (sgetn reads back "145",
not "12345"), even
though the surrounding writes to the file work.
As I step through the code, when sbuf gets instantiated, its _M_mode
variable
at the basic_filebuf level gets set to std::_S_out. (non-zero).
When I step through the sbuf.sputc(), and I get down to the
std::basic_filebuf<char, std::char_traits<char> >::overflow(int)
routine,
I see the code check the variable _M_mode in fstream.tcc at the
overflow template
at the line:
const bool __testout = _M_mode & ios_base::out;
__testout gets set to 0 because this->_M_mode at this level reads as
0 in the debugger.
When I look up the stack, sbuf->_M_mode indeed is still std::_S_out.
but in overflow(), this->_M_mode is 0.
I feel like I am missing something here that might be obvious to
someone else.
Thanks for any help/advice/pointers you can give me.
-Karl