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
+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 "*/".
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. */