Linux and aliasing?

Alexandre Oliva oliva@dcc.unicamp.br
Fri Jun 4 12:59:00 GMT 1999


On Jun  4, 1999, Joe Buck <jbuck@Synopsys.COM> wrote:

> Linus writes, to Craig:

>> _I_ think my simple extension was perfectly legitimate, adn a _lot_ more
>> obvious than a lot of things people are discussing on the lists.

> Your "simple extension" will have the effect of -fno-strict-aliasing
> for any function that does any pointer cast (there may be marginal
> differences if there are loops before the first cast).  So why not
> just use -fno-strict-aliasing and get the same code?

> I appreciate your desire for a better solution, but your suggestion
> doesn't cut it.

AFAICT, in a cast to `(some_type_t *volatile)', the `volatile' doesn't
have any actual effect on the generated code, because the pointer has
already been evaluated.  Couldn't we implement an extension by which
this `volatile' would kind of have the opposite meaning of `restrict'?
It would mean that the resulting pointer may be aliased to anything
else, so the compiler shouldn't move it around nor optimize it ``too
much''.  It seems to me that `volatile' is the right word to mean it,
especially because it would be ignored by compilers that don't support
this extension.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
{oliva,Alexandre.Oliva}@dcc.unicamp.br  aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
*** E-mail about software projects will be forwarded to mailing lists



More information about the Gcc mailing list