diff options
Diffstat (limited to 'libc/string/test-memchr.c')
-rw-r--r-- | libc/string/test-memchr.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/libc/string/test-memchr.c b/libc/string/test-memchr.c index c233ead5d..cd9a01e3d 100644 --- a/libc/string/test-memchr.c +++ b/libc/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; |