On DJGPP, rather than _M_table pointing to the mask for '\0', it points to the
mask for EOF.  It is then offset by one in ctype<char>::is(mask, char), but not
in ctype<char>::is(const char*, const char*, mask*), ctype<char>::table() or in
the constructor mask* parameter.  (ctype<char>::classic_table() returns 0.)

The constructor also sets _M_toupper and _M_tolower to point to the respective
table entries for EOF, but then doesn't use them at all, instead passing the
char parameter to ::toupper(int) or ::tolower(int), without casting it to
unsigned char.

ctype_inline.h and ctype_noninline.h in config/os/djgpp/ should probably be
updated to match the Solaris files, for example, with __ctype_mask changed to
(__dj_ctype_flags+1), __trans_upper changed to (__dj_ctype_toupper+1), and
__trans_lower changed to (__dj_ctype_tolower+1).

(This bug is similar to the old bug 7461 against Cygwin.)

-- 
           Summary: ctype<char> tables are offset by one on DJGPP
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: carey dot evans at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i386-pc-msdosdjgpp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22087

Reply via email to