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

Re: aliasing warnings [patch]


On Sep 16, 1999, Mark Mitchell <mark@codesourcery.com> wrote:

> SAVE_EXPR_RTL stores an `struct rtx_def *' as `union tree_node *'.

Couldn't we just add struct rtx_def to union tree_node to get rid of
some such warnings?

> I believe casts among unrelated pointer types are
> implementation-defined, rather than undefined, behavior, so long as
> you do not dereference them the wrong way.

Yup, but warning at the cast is the best we can do, since we'd need
complete program information to be able to test whether the pointer is
actually dereferenced.

> I think you should say:

>   warning: dereferencing the result of pointer cast may ...

Agreed.

> I don't think this warning should be on by default

-Wall, maybe?  Or maybe we should really enable it by default, so that
people will be warned about the problem sooner rather than too late.
We could always provide an option to disable it.

-- 
Alexandre Oliva http://www.dcc.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{dcc.unicamp.br,guarana.{org,com}} aoliva@{acm.org,computer.org}
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


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