This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aliasing warnings [patch]
- To: Zack Weinberg <zack at bitmover dot com>
- Subject: Re: aliasing warnings [patch]
- From: Jason Merrill <jason at cygnus dot com>
- Date: 16 Sep 1999 11:23:26 -0700
- Cc: egcs at egcs dot cygnus dot com, egcs-patches at egcs dot cygnus dot com
- References: <199909161637.JAA15001@zack.bitmover.com>
>>>>> 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