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: "Bin.Cheng" <amker dot cheng at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Bin Cheng <Bin dot Cheng at arm dot com>, "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:58:26 +0100
- Subject: Re: [PATCH PR85190]Adjust pointer for aligned access
- References: <DB6PR0802MB2504056A67C88492F350E9A1E7BE0@DB6PR0802MB2504.eurprd08.prod.outlook.com> <20180410132653.GE8577@tucnak>
On Tue, Apr 10, 2018 at 2:26 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> 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.
Sorry I already checked in, will try to correct it in another patch.
Thanks,
bin
>
>> }
>> }
>> 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