This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/38984] [4.2/4.3/4.4 Regression] NULL pointers always considered distinct by PTA, even with -fno-delete-null-pointer-checks
- From: "bonzini at gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jan 2009 11:02:26 -0000
- Subject: [Bug tree-optimization/38984] [4.2/4.3/4.4 Regression] NULL pointers always considered distinct by PTA, even with -fno-delete-null-pointer-checks
- References: <bug-38984-7849@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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.
--
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