diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 55639cd..cc9d93e 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -11965,8 +11965,9 @@ expand_builtin_memory_chk (tree exp, rtx target, enum machine_mode mode, if (! integer_all_onesp (size) && tree_int_cst_lt (size, len)) { - warning (0, "%Kcall to %D will always overflow destination buffer", - exp, get_callee_fndecl (exp)); + warning_at (tree_nonartificial_location (exp), + 0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); return NULL_RTX; } @@ -12073,6 +12074,7 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) { int is_strlen = 0; tree len, size; + location_t loc = tree_nonartificial_location (exp); switch (fcode) { @@ -12119,8 +12121,8 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) src = c_strlen (src, 1); if (! src || ! host_integerp (src, 1)) { - warning (0, "%Kcall to %D might overflow destination buffer", - exp, get_callee_fndecl (exp)); + warning_at (loc, 0, "%Kcall to %D might overflow destination buffer", + exp, get_callee_fndecl (exp)); return; } else if (tree_int_cst_lt (src, size)) @@ -12129,8 +12131,8 @@ maybe_emit_chk_warning (tree exp, enum built_in_function fcode) else if (! host_integerp (len, 1) || ! tree_int_cst_lt (size, len)) return; - warning (0, "%Kcall to %D will always overflow destination buffer", - exp, get_callee_fndecl (exp)); + warning_at (loc, 0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); } /* Emit warning if a buffer overflow is detected at compile time @@ -12187,10 +12189,9 @@ maybe_emit_sprintf_chk_warning (tree exp, enum built_in_function fcode) return; if (! tree_int_cst_lt (len, size)) - { - warning (0, "%Kcall to %D will always overflow destination buffer", - exp, get_callee_fndecl (exp)); - } + warning_at (tree_nonartificial_location (exp), + 0, "%Kcall to %D will always overflow destination buffer", + exp, get_callee_fndecl (exp)); } /* Emit warning if a free is called with address of a variable. */ @@ -12209,9 +12210,11 @@ maybe_emit_free_warning (tree exp) return; if (SSA_VAR_P (arg)) - warning (0, "%Kattempt to free a non-heap object %qD", exp, arg); + warning_at (tree_nonartificial_location (exp), + 0, "%Kattempt to free a non-heap object %qD", exp, arg); else - warning (0, "%Kattempt to free a non-heap object", exp); + warning_at (tree_nonartificial_location (exp), + 0, "%Kattempt to free a non-heap object", exp); } /* Fold a call to __builtin_object_size with arguments PTR and OST, |