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]

Re: aliasing warnings [patch]


>>>>> Zack Weinberg <zack@bitmover.com> writes:

 > The warnings would be much more useful if they named the types, but I
 > don't see a way of extracting a type name from the tree that defines
 > it.  c-aux-info.c has a lengthy private function to do it.

The C++ frontend has convenient error-reporting functions that handle
printing out all sorts of trees.  It might be nice to move that into
the language-independent code.

 > I'm not sure how many false negatives this will generate.  Casting
 > through char * or void * suppresses the warning, so a genuine aliasing
 > bug can be masked - in particular, a memcpy() that takes char * args
 > and casts them to long * may have problems but get no warning.

Would it make sense to warn about casts from char*?  The standard only says
that anything can be accessed through a char*, not vice versa.

How about adding this to the C++ frontend, too?

Jason


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