This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 PR85190]Adjust pointer for aligned access


On Tue, Apr 10, 2018 at 09:55:35AM +0000, Bin Cheng wrote:
> Hi Rainer, could you please help me double check that this solves the issue?
> 
> Thanks,
> bin
> 
> gcc/testsuite
> 2018-04-10  Bin Cheng  <bin.cheng@arm.com>
> 
> 	PR testsuite/85190
> 	* gcc.dg/vect/pr81196.c: Adjust pointer for aligned access.

> diff --git a/gcc/testsuite/gcc.dg/vect/pr81196.c b/gcc/testsuite/gcc.dg/vect/pr81196.c
> index 46d7a9e..15320ae 100644
> --- a/gcc/testsuite/gcc.dg/vect/pr81196.c
> +++ b/gcc/testsuite/gcc.dg/vect/pr81196.c
> @@ -4,14 +4,14 @@
>  
>  void f(short*p){
>    p=(short*)__builtin_assume_aligned(p,64);
> -  short*q=p+256;
> +  short*q=p+255;
>    for(;p!=q;++p,--q){
>      short t=*p;*p=*q;*q=t;

This is UB then though, because p will never be equal to q.

>    }
>  }
>  void b(short*p){
>    p=(short*)__builtin_assume_aligned(p,64);
> -  short*q=p+256;
> +  short*q=p+255;
>    for(;p<q;++p,--q){
>      short t=*p;*p=*q;*q=t;

This one is fine, sure.

	Jakub


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