This is the mail archive of the gcc-bugs@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]

[Bug c/70143] [6 Regression] false strict-aliasing warning


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70143

--- Comment #4 from Pedro Alves <palves at redhat dot com> ---
> The warning is "correct".  You are accessing object *ap (a struct a) via a
> pointer to struct b.  

I'd think that instead, we are accessing object "*&ap->i", an int, via a
pointer 
to struct b, and I'd imagine that the problem is that the frontend doesn't know 
that struct *b and int * can alias, because the first field of 'struct a',
which 
in turn is the first field of 'struct b', is an int.

So I don't see how you can call this correct?

Is this really just a warning problem, or does the compiler really think that
struct *b and int * cannot alias?

> I'll see if we can somehow make the FE code "smarter".

I imagine that the frontend misses recursing through the first field of the
first field of a struct, when adding valid-alias types.

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