Patch: New implementation of -Wstrict-aliasing

Andrew Pinski pinskia@physics.uc.edu
Sat Jan 20 02:21:00 GMT 2007


> Patch Description
> =================
> 
> The proposed patch contains a new implementation of -Wstrict-aliasing.
> The proposed implementation lives in the backend and is based on 
> flow-sensitive
> points-to information, which is computed by analyzing the entire source of
> each function.  It is not perfect (the problem is undecidable), but it 
> improves
> in all three directions: it checks whether pointers get dereferenced,
> it detects aliasing across multiple statements and it produces more
> meaningful messages.

The only problem with this implementation I can see is that once
we start folding *(int*)&float_var into using VIEW_CONVERT_EXPR, we
are no longer going to warn about this specific aliasing issue (even
though after that, we will get it correct, we should warn about it).

Yes I am working on getting that specific optimization implemented.
I mentioned about aliasing in
http://gcc.gnu.org/ml/gcc-patches/2006-09/msg00117.html

And Diego responed with:
If we've warned then I have no problems in letting the folder ignore the
alias sets.  Undefined code is fair game.  Wait for stage 1 for this
one, though.
-------------------------------------------------------------------------
So I think we still need a warning in the front-end for the obvious
aliasing issues.

Thanks,
Andrew Pinski



More information about the Gcc-patches mailing list