------- Comment #4 from pinskia at gmail dot com 2009-01-27 11:08 ------- Subject: Re: [4.2/4.3/4.4 Regression] NULL pointers always considered distinct by PTA, even with -fno-delete-null-pointer-checks
Sent from my iPhone On Jan 27, 2009, at 3:02 AM, "bonzini at gnu dot org" <gcc-bugzi...@gcc.gnu.org > wrote: > > > ------- Comment #1 from bonzini at gnu dot org 2009-01-27 11:02 > ------- > This simple patch is not enough: > > Index: tree-ssa-structalias.c > =================================================================== > --- tree-ssa-structalias.c (revision 142960) > +++ tree-ssa-structalias.c (working copy) > @@ -3030,8 +3030,14 @@ get_constraint_for_1 (tree t, VEC (ce_s, > happens below, since it will fall into the default case. The only > case we know something about an integer treated like a pointer is > when it is the NULL pointer, and then we just say it points to > - NULL. */ > - if (TREE_CODE (t) == INTEGER_CST > + NULL. > + > + Do not do that if -fno-delete-null-pointer-checks though, > because > + in that case *NULL does not fail, so it _should_ alias > *anything. > + It is not worth adding a new option or renaming the existing > one, > + since this case is relatively obscure. */ > + if (flag_delete_null_pointer_checks > + && TREE_CODE (t) == INTEGER_CST > && integer_zerop (t)) > { > temp.var = nothing_id; > > We get: > > ANYTHING = &ANYTHING > ESCAPED = *ESCAPED > NONLOCAL = &ESCAPED > INTEGER = &ANYTHING > derefaddrtmp.8 = &NONLOCAL > *ESCAPED = derefaddrtmp.8 > p = &NONLOCAL > > ... > > NULL = { } > ANYTHING = { ANYTHING } > READONLY = { READONLY } > ESCAPED = { } > NONLOCAL = { ESCAPED } > CALLUSED = { } > INTEGER = { ANYTHING } > derefaddrtmp.7 = { ESCAPED } > derefaddrtmp.8 = { NONLOCAL } > p = same as derefaddrtmp.8 > > ... > > Updating SSA information for statement a_2 = *p_1(D); > > Updating SSA information for statement D.1236_4 = *p_1(D); > > ... > > VUSE operands 2 8b > VDEF operands 0 0b > > ... > > # VUSE <SMT.9D.1248_6(D)> { SMT.9D.1248 } > aD.1233_2 = *pD.1230_1(D); > *0B ={v} 5; > # VUSE <SMT.9D.1248_6(D)> { SMT.9D.1248 } > D.1236_4 = *pD.1230_1(D); > D.1235_5 = D.1236_4 == aD.1233_2; > return D.1235_5; > > Note there is no vdef, so FRE comes and removes the second load. If that patch is not enough and the above is happening we are going to have issues wit volatiles also. > > > > -- > > bonzini at gnu dot org changed: > > What |Removed |Added > --- > --- > ---------------------------------------------------------------------- > Status|UNCONFIRMED |NEW > Ever Confirmed|0 |1 > Last reconfirmed|0000-00-00 00:00:00 |2009-01-27 11:02:25 > date| | > > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38984 > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38984