This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
pseudo-fix for PR/38984
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 27 Jan 2009 17:48:08 +0100
- Subject: pseudo-fix for PR/38984
This is only a pseudo-fix because the testcase also exhibits PR/38985.
The testcase will be fixed in 4.5 thanks to the alias-improvements branch.
The patch however is trivial enough that Richard agreed to put it in 4.4
too. Fixing PR38985 in time for 4.4.0 also seems not impossible to me.
Bootstrapped/regtested i686-pc-linux-gnu (regtested C only so far; but
there is no testcase outside gcc.dg that tries
-fno-delete-null-pointer-checks). Ok?
Paolo
2009-01-27 Paolo Bonzini <bonzini@gnu.org>
* tree-ssa-structalias.c (get_constraint_for_1): Do not
use nothing_id if -fno-delete-null-pointer-checks.
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;