This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix string/test-strncmp.c to work with wide chars.
- From: jose dot marchesi at oracle dot com (Jose E. Marchesi)
- To: Joseph Myers <joseph at codesourcery dot com>
- Cc: <libc-alpha at sourceware dot org>
- Date: Fri, 03 Jun 2016 09:36:58 +0200
- Subject: Re: [PATCH] Fix string/test-strncmp.c to work with wide chars.
- Authentication-results: sourceware.org; auth=none
- References: <87twhfski5 dot fsf at oracle dot com> <alpine dot DEB dot 2 dot 20 dot 1606022234460 dot 9542 at digraph dot polyomino dot org dot uk>
> wcsmbs/test-wcsncmp.c (i.e. string/test-strncmp with defined WIDE)
> triggers a signal in aligment-strict platforms, like sparc*-*-*.
>
> This patch fixes string/test-strncmp.c to work properly when the test is
> performed on arrays of wide chars. This includes passing align1 and
> align2 to do_test as bytes, and to use more meaningful values for middle
> chars and large chars.
A different patch (about which Carlos had some concerns) was posted at
<https://sourceware.org/ml/libc-alpha/2015-07/msg00698.html>. How do the
two compare?
Oh, I missed that patch from davem.
In the patch I am taking the same approach than in string/test-strcmp.c
and other existing tests, i.e. to keep do_test and do_test_final
interpreting align1 and align2 in number of characters, and not bytes.
The character->bytes conversion is performed by the caller.
It also adapts the middle-char and high-char values used in the tests to
wide chars, i.e. 255 is not a high value in the range of wide chars.
Note that dave's approach is used in some other tests, like
string/test-memcmp.c.
Both approaches are equally valid IMO.