This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch: libstdc++-v3 mips-irix6.2 ctype _M_table incorrectly initialized
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- To: gcc-patches at gcc dot gnu dot org
- Cc: aoliva at redhat dot com, bkoz at redhat dot com, cgf at redhat dot com, dj at redhat dot com, mark at codesourcery dot com
- Date: Fri, 3 May 2002 00:26:09 -0400 (EDT)
- Subject: Patch: libstdc++-v3 mips-irix6.2 ctype _M_table incorrectly initialized
I had some libstdc++-v3 failures on mips-irix6.2 shown here:
FAIL: 21_strings/inserters_extractors.cc execution test
FAIL: 26_numerics/complex_inserters_extractors.cc execution test
FAIL: 27_io/istream_extractor_arith.cc execution test
FAIL: 27_io/istream_extractor_char.cc execution test
FAIL: 27_io/istream_manip.cc execution test
FAIL: 27_io/istream_sentry.cc execution test
All of these I traced to the fact that the ctype was broken somehow.
Further investigation lead me to realize that the _M_table init in
libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h was being
set to `__ctype', but it should have been set to `__ctype + 1'.
(Recall, the irix5.2 config dir is used up through irix6.4.) The fact
that the +1 is necessary is evident by the fact that all of the ctype
macros in ctype.h are of this form:
> #define isdigit(c) ((__ctype + 1)[c] & _N)
> #define isxdigit(c) ((__ctype + 1)[c] & _X)
> #define isalnum(c) ((__ctype + 1)[c] & (_U | _L | _N))
> #define isspace(c) ((__ctype + 1)[c] & _S)
> [...] etc
I was able to get a copy of irix5.3's ctype.h from Chris Faylor
<cgf@redhat.com> (Thanks!) and it did the same thing WRT +1 so I'm
going to assume this change applies there also.
The following patch was tested on the current 3.1 branch on
mips-sgi-irix6.2 and it corrected the above errors with no
regressions. I believe this bug existed ever since Alexandre created
them, so its not a regression (not 3.1 material.) Therefore I'd like
to queue it for the .1 release to follow.
Ok for trunk and queue for 3.1.1?
Thanks,
--Kaveh
2002-05-03 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* ctype_noninline.h (classic_table): Return __ctype + 1.
(ctype:_M_table): Initialize to classic_table(), not __ctype.
diff -rup egcc-3.1-CVS20020428/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h /caip/u99/ghazi/gcc-testing/egcc-3.1-CVS20020428/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h
--- egcc-3.1-CVS20020428/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h Sun Jan 20 23:08:50 2002
+++ /caip/u99/ghazi/gcc-testing/egcc-3.1-CVS20020428/libstdc++-v3/config/os/irix/irix5.2/bits/ctype_noninline.h Wed May 1 01:24:56 2002
@@ -36,19 +36,19 @@
const ctype_base::mask*
ctype<char>::classic_table() throw()
- { return 0; }
+ { return __ctype + 1; }
ctype<char>::ctype(__c_locale, const mask* __table, bool __del,
size_t __refs)
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
_M_toupper(NULL), _M_tolower(NULL),
- _M_table(!__table ? __ctype : __table)
+ _M_table(!__table ? classic_table() : __table)
{ }
ctype<char>::ctype(const mask* __table, bool __del, size_t __refs)
: __ctype_abstract_base<char>(__refs), _M_del(__table != 0 && __del),
_M_toupper(NULL), _M_tolower(NULL),
- _M_table(!__table ? __ctype : __table)
+ _M_table(!__table ? classic_table() : __table)
{ }
char