aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 7dcf993..821e581 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -15018,8 +15018,8 @@ tree_single_nonzero_warnv_p (tree t, bool *strict_overflow_p)
return false;
/* Weak declarations may link to NULL. */
- if (VAR_OR_FUNCTION_DECL_P (base))
- return !DECL_WEAK (base);
+ if (DECL_P (base) && flag_delete_null_pointer_checks)
+ return !VAR_OR_FUNCTION_DECL_P (base) || !DECL_WEAK (base);
/* Constants are never weak. */
if (CONSTANT_CLASS_P (base))