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]


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

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