This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH PR85190]Adjust pointer for aligned access
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Bin Cheng <Bin dot Cheng at arm dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, nd <nd at arm dot com>, "ro at cebitec dot uni-bielefeld dot de" <ro at cebitec dot uni-bielefeld dot de>
- Date: Tue, 10 Apr 2018 15:26:53 +0200
- Subject: Re: [PATCH PR85190]Adjust pointer for aligned access
- References: <DB6PR0802MB2504056A67C88492F350E9A1E7BE0@DB6PR0802MB2504.eurprd08.prod.outlook.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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