This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix test-wcsncmp BUS errors.


From: David Miller <davem@davemloft.net>
Date: Tue, 21 Jul 2015 14:39:04 -0700 (PDT)

> As currently coded, the strncmp tests dereference unaligned pointers
> when setting up the test patterns.  This results in SIGBUS errors
> on Sparc, for example.
> 
> Force the alignment arguments to be aligned properly for the character
> type being tested.
> 
> Ok to commit?

Ping?

> 2015-07-21  David S. Miller  <davem@davemloft.net>
> 
> 	* string/test-strncmp.c (do_test_limit): Align align1 and align2
> 	to CHARBYTES.
> 	(do_test): Likewise.
> 
> diff --git a/string/test-strncmp.c b/string/test-strncmp.c
> index fb57a9b..277eb2c 100644
> --- a/string/test-strncmp.c
> +++ b/string/test-strncmp.c
> @@ -156,6 +156,9 @@ do_test_limit (size_t align1, size_t align2, size_t len, size_t n, int max_char,
>    size_t i, align_n;
>    CHAR *s1, *s2;
>  
> +  align1 &= ~(CHARBYTES - 1);
> +  align2 &= ~(CHARBYTES - 1);
> +
>    if (n == 0)
>      {
>        s1 = (CHAR *) (buf1 + page_size);
> @@ -204,6 +207,9 @@ do_test (size_t align1, size_t align2, size_t len, size_t n, int max_char,
>    size_t i;
>    CHAR *s1, *s2;
>  
> +  align1 &= ~(CHARBYTES - 1);
> +  align2 &= ~(CHARBYTES - 1);
> +
>    if (n == 0)
>      return;
>  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]