aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-typeck.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 138af07..7d58e8d 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -3949,10 +3949,9 @@ pointer_diff (location_t loc, tree op0, tree op1, tree *instrument_expr)
pedwarn (loc, OPT_Wpointer_arith,
"pointer to a function used in subtraction");
- if (sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
+ if (current_function_decl != NULL_TREE
+ && sanitize_flags_p (SANITIZE_POINTER_SUBTRACT))
{
- gcc_assert (current_function_decl != NULL_TREE);
-
op0 = save_expr (op0);
op1 = save_expr (op1);
@@ -12324,6 +12323,7 @@ build_binary_op (location_t location, enum tree_code code,
}
if ((code0 == POINTER_TYPE || code1 == POINTER_TYPE)
+ && current_function_decl != NULL_TREE
&& sanitize_flags_p (SANITIZE_POINTER_COMPARE))
{
op0 = save_expr (op0);