Re: vectors and strict aliasing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"John Graley" <jgraley@xxxxxxxxxxxx> writes:

> I understand strict aliasing to be an aspect of standardised C in
> which distinct types may be assumed by the compiler not to alias one
> another. GCC appears to regard vectors as distinct from their base
> scalars, so that mixing vector and scalar accesses to the same data
> can fall foul of re-ordering.

I don't think this is accurate, although I also don't think that gcc's
behaviour is documented.  Currently a pointer to a vector type is
considered to alias a pointer to the base type of the vector.  Do you
have a test case which shows otherwise?

The relevant comment in gcc/alias.c:

  /* Unless the language specifies otherwise, let vector types alias
     their components.  This avoids some nasty type punning issues in
     normal usage.  And indeed lets vectors be treated more like an
     array slice.  */

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux