This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] ignoring type alias conflicts between structures andscalars
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Thu, 25 Nov 2004 11:02:06 -0500
- Subject: Re: [RFC] ignoring type alias conflicts between structures andscalars
- Organization: Red Hat Canada
- References: <10411251551.AA05808@vlsi1.ultra.nyu.edu>
On Thu, 2004-11-25 at 10:51 -0500, Richard Kenner wrote:
> A pointer to an
> integer could alias the structure because the integer field is addressable.
>
Ah, OK. So, it would be safe to short-circuit the alias conflict then?
> Note that the flag DECL_NONADDRESSABLE_P exists for those languages where
> there is a way to indicate that taking the address of a component of a
> structure is not allowed. In that case, the two types don't conflict.
>
> I'm also attaching a program that breaks this patch. Basically, it
> causes 'bar()' to return &X.
>
> But that breakage is OK because the pointer-punning cast is supposed to be
> incompatible with -fstrict-aliasing.
>
Right, but we don't even warn about it. I'm thinking that I also need a
check for -fstrict-aliasing in the patch.
Would it be the same problem if we were dealing with a union instead of
a structure?
Thanks. Diego.