aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/c/c-typeck.cc b/gcc/c/c-typeck.cc
index 9d65130..224a9cb 100644
--- a/gcc/c/c-typeck.cc
+++ b/gcc/c/c-typeck.cc
@@ -12749,12 +12749,16 @@ build_binary_op (location_t location, enum tree_code code,
&& (code1 == INTEGER_TYPE || code1 == REAL_TYPE
|| code1 == FIXED_POINT_TYPE || code1 == COMPLEX_TYPE))
short_compare = 1;
- else if (code0 == POINTER_TYPE && null_pointer_constant_p (orig_op1))
+ else if (code0 == POINTER_TYPE
+ && (code1 == NULLPTR_TYPE
+ || null_pointer_constant_p (orig_op1)))
{
maybe_warn_for_null_address (location, op0, code);
result_type = type0;
}
- else if (code1 == POINTER_TYPE && null_pointer_constant_p (orig_op0))
+ else if (code1 == POINTER_TYPE
+ && (code0 == NULLPTR_TYPE
+ || null_pointer_constant_p (orig_op0)))
{
maybe_warn_for_null_address (location, op1, code);
result_type = type1;