summaryrefslogtreecommitdiff
path: root/string/test-memchr.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2009-06-16 10:23:31 -0700
committerUlrich Drepper <drepper@redhat.com>2009-06-16 10:23:31 -0700
commitfab8238de69de67637d21923b3ec1c26e4ce8450 (patch)
treec5e43b38acd54f9f46d3856a9b71d22b70ce1b3d /string/test-memchr.c
parent435aa54b3b9c1c87498e8bb3831394fd42220fa7 (diff)
downloadglibc-fab8238de69de67637d21923b3ec1c26e4ce8450.tar.gz
Fix x86-64 memchr for large lengths.
Diffstat (limited to 'string/test-memchr.c')
-rw-r--r--string/test-memchr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/string/test-memchr.c b/string/test-memchr.c
index c233ead5dd..cd9a01e3da 100644
--- a/string/test-memchr.c
+++ b/string/test-memchr.c
@@ -1,5 +1,5 @@
/* Test and measure memchr functions.
- Copyright (C) 1999, 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2005, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Jakub Jelinek <jakub@redhat.com>, 1999.
@@ -144,7 +144,12 @@ do_random_tests (void)
}
if (pos < len)
- result = (char *) (p + pos + align);
+ {
+ size_t r = random ();
+ if ((r & 31) == 0)
+ len = ~(uintptr_t) (p + align) - ((r >> 5) & 31);
+ result = (char *) (p + pos + align);
+ }
else
result = NULL;