This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: AIX I/O failures
On Thu, Jan 25, 2001 at 09:59:14PM +0100, Gabriel Dos Reis wrote:
> It would be kind to hear from those who have access to AIX boxes to
> test the above workaround.
Here's what I've got in my local tree. The chapter-27-related testsuite
results are the same with and without the patch.
Enh. Looking at the patch below, I think that __align is supposed to
be __aligned__.
Index: include/bits/std_iostream.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/std_iostream.h,v
retrieving revision 1.2
diff -u -3 -r1.2 std_iostream.h
--- std_iostream.h 2001/01/10 17:24:11 1.2
+++ std_iostream.h 2001/01/25 20:59:28
@@ -40,15 +40,15 @@
namespace std
{
- extern istream cin;
- extern ostream cout;
- extern ostream cerr;
- extern ostream clog;
+ extern istream& cin;
+ extern ostream& cout;
+ extern ostream& cerr;
+ extern ostream& clog;
#ifdef _GLIBCPP_USE_WCHAR_T
- extern wistream wcin;
- extern wostream wcout;
- extern wostream wcerr;
- extern wostream wclog;
+ extern wistream& wcin;
+ extern wostream& wcout;
+ extern wostream& wcerr;
+ extern wostream& wclog;
#endif
// For construction of filebuffers for cout, cin, cerr, clog et. al.
Index: src/ios.cc
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/src/ios.cc,v
retrieving revision 1.12
diff -u -3 -r1.12 ios.cc
--- ios.cc 2001/01/17 07:44:57 1.12
+++ ios.cc 2001/01/25 20:59:28
@@ -109,15 +109,37 @@
int ios_base::Init::_S_ios_base_init = 0;
bool ios_base::Init::_S_synced_with_stdio = true;
- istream cin(NULL);
- ostream cout(NULL);
- ostream cerr(NULL);
- ostream clog(NULL);
+ namespace
+ {
+ char __cin_storage[sizeof(istream)]
+ __attribute__ ((__align (__alignof__ (istream))));
+ char __cout_storage[sizeof(ostream)]
+ __attribute__ ((__align (__alignof__ (ostream))));
+ char __cerr_storage[sizeof(ostream)]
+ __attribute__ ((__align (__alignof__ (ostream))));
+ char __clog_storage[sizeof(ostream)]
+ __attribute__ ((__align (__alignof__ (ostream))));
+#ifdef _GLIBCPP_USE_WCHAR_T
+ char __wcin_storage[sizeof(wistream)]
+ __attribute__ ((__align (__alignof__ (wistream))));
+ char __wcout_storage[sizeof(wostream)]
+ __attribute__ ((__align (__alignof__ (wostream))));
+ char __wcerr_storage[sizeof(wostream)]
+ __attribute__ ((__align (__alignof__ (wostream))));
+ char __wclog_storage[sizeof(wostream)]
+ __attribute__ ((__align (__alignof__ (wostream))));
+#endif
+ }
+
+ istream& cin = *(istream*)(&__cin_storage[0]);
+ ostream& cout = *(ostream*)(&__cout_storage[0]);
+ ostream& cerr = *(ostream*)(&__cerr_storage[0]);
+ ostream& clog = *(ostream*)(&__clog_storage[0]);
#ifdef _GLIBCPP_USE_WCHAR_T
- wistream wcin(NULL);
- wostream wcout(NULL);
- wostream wcerr(NULL);
- wostream wclog(NULL);
+ wistream& wcin = *(wistream*)(&__wcin_storage[0]);
+ wostream& wcout = *(wostream*)(&__wcout_storage[0]);
+ wostream& wcerr = *(wostream*)(&__wcerr_storage[0]);
+ wostream& wclog = *(wostream*)(&__wclog_storage[0]);
#endif
ios_base::failure::failure(const string& __str) throw()
@@ -143,10 +165,10 @@
_M_cout = new filebuf(1, "stdout", ios_base::out);
_M_cin = new filebuf(0, "stdin", ios_base::in);
_M_cerr = new filebuf(2, "stderr", ios_base::out);
- new (&cout) ostream(_M_cout);
- new (&cin) istream(_M_cin);
- new (&cerr) ostream(_M_cerr);
- new (&clog) ostream(_M_cerr);
+ new (__cout_storage) ostream(_M_cout);
+ new (__cin_storage) istream(_M_cin);
+ new (__cerr_storage) ostream(_M_cerr);
+ new (__clog_storage) ostream(_M_cerr);
cin.tie(&cout);
cerr.flags(ios_base::unitbuf);
@@ -154,10 +176,10 @@
_M_wcout = new wfilebuf(1, "stdout", ios_base::out);
_M_wcin = new wfilebuf(0, "stdin", ios_base::in);
_M_wcerr = new wfilebuf(2, "stderr", ios_base::out);
- new (&wcout) wostream(_M_wcout);
- new (&wcin) wistream(_M_wcin);
- new (&wcerr) wostream(_M_wcerr);
- new (&wclog) wostream(_M_wcerr);
+ new (__wcout_storage) wostream(_M_wcout);
+ new (__wcin_storage) wistream(_M_wcin);
+ new (__wcerr_storage) wostream(_M_wcerr);
+ new (__wclog_storage) wostream(_M_wcerr);
wcin.tie(&wcout);
wcerr.flags(ios_base::unitbuf);
#endif