public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Diego Novillo <dnovillo@redhat.com>
Cc: Richard Guenther <richard.guenther@gmail.com>,
	gcc-help@gcc.gnu.org, gcc@gcc.gnu.org, truedfx@gentoo.org,
	Ian Lance Taylor <ian@airs.com>,
	Richard Henderson <rth@redhat.com>
Subject: Re: More fun with aliasing - removing assignments?
Date: Tue, 02 Aug 2005 13:40:00 -0000	[thread overview]
Message-ID: <20050802133956.GA1548@nevyn.them.org> (raw)
In-Reply-To: <20050802130851.GA25506@topo.toronto.redhat.com>

On Tue, Aug 02, 2005 at 09:08:51AM -0400, Diego Novillo wrote:
> On Tue, Aug 02, 2005 at 02:56:50PM +0200, Richard Guenther wrote:
> > Oh, and a workaround and slight correction would be to write
> > 
> >     void nconc (unsigned x, unsigned y) {
> >          unsigned *ptr = &((cons *)x)->cdr;
> >          while(!(*ptr & 3))
> >              ptr = &((cons *)(*ptr))->cdr;
> >          *ptr = y;
> >      }
> > 
> No.  Same problem.  The aliaser would say "yes, ptr points
> anywhere, but it cannot escape the local frame".  The final store
> is dead just the same.
> 
> We only "get it right" because we do not distinguish between
> different degrees of points-anywhere.

Then the alias analyzer's broken.  This isn't pointer arithmetic in the
sense that you mean.  It would be if the line were:

             ptr = &((cons *)(ptr))->cdr;

which is equivalent to some offset plus ptr.  But there's an extra
dereference:

             ptr = &((cons *)(*ptr))->cdr;
                              ^

As far as I can tell, this code doesn't actually violate any of the
aliasing rules.  It just looks funny.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

  reply	other threads:[~2005-08-02 13:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20050801214735.GA12919@boostbox>
2005-08-02  5:12 ` Ian Lance Taylor
2005-08-02 12:33   ` Diego Novillo
2005-08-02 12:51     ` Richard Guenther
2005-08-02 12:57       ` Richard Guenther
2005-08-02 13:09         ` Diego Novillo
2005-08-02 13:40           ` Daniel Jacobowitz [this message]
2005-08-02 13:57             ` Diego Novillo
2005-08-02 14:05               ` Daniel Jacobowitz
2005-08-02 14:10                 ` Diego Novillo
2005-08-02 17:21                   ` Ian Lance Taylor
2005-08-02 19:34                     ` Daniel Berlin
2005-08-02 14:16               ` Andreas Schwab
2005-08-02 17:06     ` Richard Henderson
2005-08-02 17:08       ` Diego Novillo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050802133956.GA1548@nevyn.them.org \
    --to=drow@false.org \
    --cc=dnovillo@redhat.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=gcc@gcc.gnu.org \
    --cc=ian@airs.com \
    --cc=richard.guenther@gmail.com \
    --cc=rth@redhat.com \
    --cc=truedfx@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).