This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC aliasing rules: more aggressive than C99?
Andrew Haley <aph <at> redhat.com> writes:
> On 01/03/2010 10:53 AM, Richard Guenther wrote:
> > GCC follows its own documentation here, not some random
> > websites and maybe not the strict reading of the standard.
>
> GCC is compatible with C99 in this regard.
I do not believe this is true. Your argument that GCC complies with C99
(which you moved to gcc-help@) is based on the argument that these are
not compatible types:
union u { int x; }
int x;
However, I did not claim that they are compatible types, nor does my
argument rely on them being compatible types. Rather, my argument is
based on section 6.5, paragraph 7 of C99, which I quoted, which
specifies the circumstances under which an object may or may not be
aliased. The case of compatible types is one case, but not the only
case, in which values may be aliased according to the standard.
Josh