This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: while working on an optimized version of strnlen, some string tests fail
- From: Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- To: libc-help at sourceware dot org
- Date: Thu, 17 Nov 2016 16:52:45 -0200
- Subject: Re: while working on an optimized version of strnlen, some string tests fail
- Authentication-results: sourceware.org; auth=none
- References: <CAEjPfw0FMybM-GNrwz5kqgXHRqQTNwG8079wMp6Qvybg5ZDRZA@mail.gmail.com>
On 17/11/2016 16:27, Nam-goo Lee wrote:
> Hi.
>
> I'm working on an optimized version of strnlen function for arm.
> But following tests fail, and I'm stuck here finding the reasons for
> the failure.
>
> FAIL: string/stratcliff
> FAIL: string/test-stpncpy
> FAIL: string/test-strncpy
> Summary of test results:
> 3 FAIL
> 57 PASS
>
> I'm surprised to see that tests for functions other than strnlen fail.
> I'd really appreciate to get some hints on what the 'stratcliff' test does,
> and the reasons for the failure.
> Attached my code.
>
> Thanks.
>
Hi,
ARM uses default string/str{n,p}cpy.c code and strncpy code has:
26 char *
27 STRNCPY (char *s1, const char *s2, size_t n)
28 {
29 size_t size = __strnlen (s2, n);
So if your optimized strnlen does not provide the expected correct result
the code will potentially fail. It might the case where it is stressing
a case that test-strnlen does not issue. Either way, you need to a full
clean make check to make sure the implementation is ready for upstream review.