This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Failure of test07 in 27_io/filebuf_members.cc under HP-UX (PR 9964)


I have examined the failure of 27_io/filebuf_members.cc on
hppa2.0w-hp-hpux11.11.  The test fails because the following code
from config/io/basic_file_stdio.cc doesn't close the file after a
character is written to a broken pipe:

  __basic_file<char>* 
  __basic_file<char>::close()
  { 
    __basic_file* __retval = static_cast<__basic_file*>(NULL);
    if (this->is_open())
      {
	fflush(_M_cfile);
	if ((_M_cfile_created && fclose(_M_cfile) == 0) || !_M_cfile_created)
	  {
	    _M_cfile = 0;
	    __retval = this;
	  }
      }
    return __retval;
  }

The fflush and fclose calls both fail with error EPIPE.  As a result,
_M_cfile is not set to 0 and the test fails.  I don't know if the
fclose call actually closes the stream or not.

The single unix specification indicates that any use of a stream
after calling fclose will cause undefined behavior.  So, possibly
_M_cfile should always be set to 0 after calling fclose.

Dave
-- 
J. David Anglin                                  dave dot anglin at nrc-cnrc dot gc dot ca
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]