This is the mail archive of the
mailing list for the glibc project.
Re: my strstr is broken
- From: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- To: "siddhesh dot poyarekar at gmail dot com" <siddhesh dot poyarekar at gmail dot com>
- Cc: "brunni at netestate dot de" <brunni at netestate dot de>, "cottrell at wfu dot edu" <cottrell at wfu dot edu>, "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, "libc-help at sourceware dot org" <libc-help at sourceware dot org>, nd <nd at arm dot com>
- Date: Tue, 11 Sep 2018 18:46:26 +0000
- Subject: Re: my strstr is broken
> Is this a non-x86 architecture? I can reproduce this on the glibc
> 2.28 tag when I hack the ifunc resolver to ignore
> __strstr_sse2_unaligned and always use the stock __strstr.
It's the generic strstr indeed. The issue is due to the long needle code using
the same AVAILABLE macro as for short needles. Since the macro now
ensures the haystack contains up to 512 valid characters, it cannot handle
needles which are longer than this. The fix is easy, just add the needle length.
I'll post a patch.
> It looks like the test case is fixed on trunk, with, but I'll take
> a closer look at it later to confirm.
No it still exists on trunk, but you need avoid tests with a trivial first match
which is now handled early as a special case. Also to make it fail consistently
the needle needs to be longer than 1024 characters. Unfortunately neither the
tests or benchmarks ever call two_way_long_needle...