[Bug libc/18510] New: tilegx: strcasestr() does not handle non-ascii locales

cmetcalf at ezchip dot com sourceware-bugzilla@sourceware.org
Tue Jun 9 19:41:00 GMT 2015


https://sourceware.org/bugzilla/show_bug.cgi?id=18510

            Bug ID: 18510
           Summary: tilegx: strcasestr() does not handle non-ascii locales
           Product: glibc
           Version: 2.21
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: cmetcalf at ezchip dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

The vectorized strcasestr() for tilegx (sysdeps/tile/tilegx/strstr.c) does
lowercasing 8 characters at a time with vector operations, creating a mask of
whether the characters are in the range 'A'..'Z', and then subtracting 32 for
each character in that range.  This is correct for ASCII-cased locales but not
for non-ascii case locales.  It's straightforward to know if we're in such a
locale or not:

  __locale_t loc = _NL_CURRENT_LOCALE;
  struct __locale_data *ctype = loc->__locales[LC_CTYPE];
  int nonascii = ctype->values[_NL_ITEM_INDEX(_NL_CTYPE_NONASCII_CASE)].word

but it is less clear whether the word-at-a-time infrastructure remains faster
if we have do eight tolower() function calls per word read, since the time
taken to do conversions on characters past the end of the string will penalize
the overall performance of this routine.  For reasonably-sized strings that
approach will still be faster.  However, defer this for now since Ondřej Bílka
is working on a more general framework.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Glibc-bugs mailing list