aboutsummaryrefslogtreecommitdiff
path: root/gcc/asan.c
diff options
context:
space:
mode:
authorMax Ostapenko <m.ostapenko@partner.samsung.com>2014-07-07 17:31:18 +0300
committerMaxim Ostapenko <chefmax@gcc.gnu.org>2014-07-07 17:31:18 +0300
commit0f05a19962a367aaac5b6ae8f7638a2bd77e4b29 (patch)
treedb570b973c519ea2a1d227f61cc00851a179b8e7 /gcc/asan.c
parent625685bebb0c7dd8015ec5ec9cbfdfc857ab2267 (diff)
downloadgcc-0f05a19962a367aaac5b6ae8f7638a2bd77e4b29.zip
gcc-0f05a19962a367aaac5b6ae8f7638a2bd77e4b29.tar.gz
gcc-0f05a19962a367aaac5b6ae8f7638a2bd77e4b29.tar.bz2
Do not instrument first byte in strlen if already instrumented.
gcc/ * asan.c (instrument_strlen_call): Do not instrument first byte in strlen if already instrumented. gcc/testsuite/ * c-c++-common/asan/no-redundant-instrumentation-9.c: New test. From-SVN: r212332
Diffstat (limited to 'gcc/asan.c')
-rw-r--r--gcc/asan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/asan.c b/gcc/asan.c
index 9eeafa8..20d78df 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2026,6 +2026,7 @@ instrument_strlen_call (gimple_stmt_iterator *iter)
location_t loc = gimple_location (call);
tree str_arg = gimple_call_arg (call, 0);
+ bool start_instrumented = has_mem_ref_been_instrumented (str_arg, 1);
tree cptr_type = build_pointer_type (char_type_node);
gimple str_arg_ssa =
@@ -2037,7 +2038,8 @@ instrument_strlen_call (gimple_stmt_iterator *iter)
build_check_stmt (loc, gimple_assign_lhs (str_arg_ssa), NULL_TREE, 1, iter,
/*non_zero_len_p*/true, /*before_p=*/true,
- /*is_store=*/false, /*is_scalar_access*/true, /*align*/0);
+ /*is_store=*/false, /*is_scalar_access*/true, /*align*/0,
+ start_instrumented, start_instrumented);
gimple g =
gimple_build_assign_with_ops (POINTER_PLUS_EXPR,