aboutsummaryrefslogtreecommitdiff
path: root/gcc/asan.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2013-11-03 17:59:31 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2013-11-03 17:59:31 +0000
commitb906f4ca813779c4df4a9449700e8f52022f757f (patch)
tree47ea0e1220f5468397f6fdb89cae25257bd9e763 /gcc/asan.c
parent612211412cdcd9112fb2538f2a2bbc5a18c2d16d (diff)
downloadgcc-b906f4ca813779c4df4a9449700e8f52022f757f.zip
gcc-b906f4ca813779c4df4a9449700e8f52022f757f.tar.gz
gcc-b906f4ca813779c4df4a9449700e8f52022f757f.tar.bz2
Implement -fsanitize=vla-bound.
* opts.c (common_handle_option): Handle vla-bound. * sanitizer.def (BUILT_IN_UBSAN_HANDLE_VLA_BOUND_NOT_POSITIVE): Define. * flag-types.h (enum sanitize_code): Add SANITIZE_VLA. * asan.c (initialize_sanitizer_builtins): Build BT_FN_VOID_PTR_PTR. c-family/ * c-ubsan.c: Don't include hash-table.h. (ubsan_instrument_vla): New function. * c-ubsan.h: Declare it. cp/ * decl.c (cp_finish_decl): Move C++1y bounds checking... (compute_array_index_type): ...here. Add VLA instrumentation. Call stabilize_vla_size. (grokdeclarator): Don't call stabilize_vla_size here. c/ * c-decl.c (grokdeclarator): Add VLA instrumentation. testsuite/ * g++.dg/ubsan/cxx1y-vla.C: New test. * c-c++-common/ubsan/vla-3.c: New test. * c-c++-common/ubsan/vla-2.c: New test. * c-c++-common/ubsan/vla-4.c: New test. * c-c++-common/ubsan/vla-1.c: New test. From-SVN: r204334
Diffstat (limited to 'gcc/asan.c')
-rw-r--r--gcc/asan.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/asan.c b/gcc/asan.c
index 8139719..763c59a 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -2021,6 +2021,9 @@ initialize_sanitizer_builtins (void)
tree BT_FN_VOID = build_function_type_list (void_type_node, NULL_TREE);
tree BT_FN_VOID_PTR
= build_function_type_list (void_type_node, ptr_type_node, NULL_TREE);
+ tree BT_FN_VOID_PTR_PTR
+ = build_function_type_list (void_type_node, ptr_type_node,
+ ptr_type_node, NULL_TREE);
tree BT_FN_VOID_PTR_PTR_PTR
= build_function_type_list (void_type_node, ptr_type_node,
ptr_type_node, ptr_type_node, NULL_TREE);