]> gcc.gnu.org Git - gcc.git/commitdiff
re PR middle-end/39701 (Revision 145846 caused many test failures)
authorPaolo Bonzini <bonzini@gnu.org>
Fri, 10 Apr 2009 16:06:43 +0000 (16:06 +0000)
committerPaolo Bonzini <bonzini@gcc.gnu.org>
Fri, 10 Apr 2009 16:06:43 +0000 (16:06 +0000)
2009-04-10  Paolo Bonzini  <bonzini@gnu.org>

PR middle-end/39701
        * fold-const.c (tree_single_nonzero_warnv_p): Pass non-static
        variables as non-NULL even with -fdelete-null-pointer-checks.

From-SVN: r145927

gcc/ChangeLog
gcc/fold-const.c

index 62a1c433b60f96c2ebb8988defeeb75b53bc655f..a77df07a6af38d86e1c6d0f310061ef38bbba7fe 100644 (file)
@@ -1,3 +1,9 @@
+2009-04-10  Paolo Bonzini  <bonzini@gnu.org>
+
+       PR middle-end/39701
+        * fold-const.c (tree_single_nonzero_warnv_p): Pass non-static
+        variables as non-NULL even with -fdelete-null-pointer-checks.
+
 2009-04-10  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/rs6000/darwin-vecsave.asm: Remove extra "*/".
index 821e581348a88e2155fe2fa5704141678ebf7248..dd2f62d4a4b4b44ab4b2387ae876cdb438c91205 100644 (file)
@@ -15017,8 +15017,12 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
        if (!base)
          return false;
 
-       /* Weak declarations may link to NULL.  */
-       if (DECL_P (base) && flag_delete_null_pointer_checks)
+       /* Weak declarations may link to NULL.  Other things may also be NULL
+          so protect with -fdelete-null-pointer-checks; but not variables
+          allocated on the stack.  */
+       if (DECL_P (base)
+           && (flag_delete_null_pointer_checks
+               || (TREE_CODE (base) == VAR_DECL && !TREE_STATIC (base))))
          return !VAR_OR_FUNCTION_DECL_P (base) || !DECL_WEAK (base);
 
        /* Constants are never weak.  */
This page took 0.13014 seconds and 5 git commands to generate.