------- Comment #11 from rguenther at suse dot de  2008-05-07 08:21 -------
Subject: Re:  [4.1/4.3/4.4 Regression] Wrong code
 involving restricted pointers to non-restricted pointers

On Tue, 6 May 2008, jakub at gcc dot gnu dot org wrote:

> ------- Comment #6 from jakub at gcc dot gnu dot org  2008-05-06 22:56 -------
> Created an attachment (id=15588)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15588&action=view)
>  --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=15588&action=view)
> gcc44-pr36013.patch
> 
> Patch I've bootstrapped/regtested on x86_64-linux.  Will you check this in, or
> should I mail it to gcc-patches?
> 
> I've played with testcases like:
> 
> int
> foo (int *__restrict p, int *__restrict q)
> {
>   int *r, *s, t;
>   *p = 1;
>   *q = 2;
>   p[6] = 3;
>   q[6] = 4;
>   for (r = p, s = q, t = 0; r < p + 64; r++, s++)
>     {
>       *r = 7;
>       *s = 88;
>       t += *r;
>     }
>   return t;
> }
> 
> and here neither tree nor RTL aliasing is ATM able to optimize the subsequent
> read from *r out - while the accesses before the loop use different alias sets
> (3 resp. 4), in the loop everything uses alias set 2, but that isn't a
> regression introduced with this patch, so probably DECL_BASED_ON_RESTRICT_P
> stuff needs more work, but that is unrelated to this bug.

The patch/rfc I posted two days ago optimizes the above case on the tree
level.  I will make sure something like that goes into 4.4.

Richard.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36013

Reply via email to