diff options
author | Jakub Jelinek <jakub@redhat.com> | 2009-06-16 10:23:31 -0700 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-06-16 10:23:31 -0700 |
commit | fab8238de69de67637d21923b3ec1c26e4ce8450 (patch) | |
tree | c5e43b38acd54f9f46d3856a9b71d22b70ce1b3d /string/test-memchr.c | |
parent | Consolidate PIE linking Makefile rules. (diff) | |
download | glibc-fab8238de69de67637d21923b3ec1c26e4ce8450.tar.gz glibc-fab8238de69de67637d21923b3ec1c26e4ce8450.tar.bz2 glibc-fab8238de69de67637d21923b3ec1c26e4ce8450.zip |
Fix x86-64 memchr for large lengths.
Diffstat (limited to 'string/test-memchr.c')
-rw-r--r-- | string/test-memchr.c | 9 |
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; |