This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] ignoring type alias conflicts between structures andscalars


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]