This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: aliasing warnings [patch]
- To: David Edelsohn <dje AT watson.ibm dot com>
- Subject: Re: aliasing warnings [patch]
- From: Zack Weinberg <zack AT bitmover dot com>
- Date: Thu, 16 Sep 1999 12:38:26 -0700
- cc: Mark Mitchell <mark AT codesourcery dot com>, egcs AT egcs.cygnus dot com, egcs-patches AT egcs.cygnus dot com
- References: <9909161717.AA27526@marc.watson.ibm.com>
David Edelsohn wrote:
> >>>>> Mark Mitchell writes:
>
> Mark> I don't think this warning should be on by default; it's going to
> Mark> generate a ton of false positives. Probably many more than the RMS
> Mark> proposal would. And, I don't see how to get line-number information
> Mark> for the RMS proposal. I do think this warning might help interested
> Mark> parties track down problems in their software, and thereby help to
> Mark> avoid getting bitten by -fstrict-aliasing.
> Great work, Zack!
>
> Is RMS's proposal more accurate about warning in function which
> are dereferencing a pointer incorrectly, as opposed to assigning pointers?
> Maybe we really want both warnings enabled together: one to highlight the
> questionable lines and the other to say that the function containing those
> lines may be dereferencing the pointer incorrectly so the user should
> examine warnings in that function more carefully.
This is an interesting idea, I'll look into it.
My problem with RMS's proposal was that it is nondeterministic: the
warnings you get depend on how clever the compiler is today. It
appears to fail both ways, too: you might get no warning but still
have alias analysis break your code, and you might get a warning when
there was no problem.
My patch gets tons of false positives, but it is deterministic. I
think the number of false positives can be cut down, too. I don't
know how many false negatives there are, unfortunately.
zw