diff options
author | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-03 17:59:31 +0000 |
---|---|---|
committer | mpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-03 17:59:31 +0000 |
commit | 2c4c347700af66c7e5ce7c0f998270613e62b988 (patch) | |
tree | 47ea0e1220f5468397f6fdb89cae25257bd9e763 /gcc/opts.c | |
parent | ea151fae4de4aca6d2ce029bd7fe00ded77b0e9c (diff) | |
download | gcc-2c4c347700af66c7e5ce7c0f998270613e62b988.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204334 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts.c')
-rw-r--r-- | gcc/opts.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/opts.c b/gcc/opts.c index 1d02b1020d5..4db20f038d9 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1444,6 +1444,7 @@ common_handle_option (struct gcc_options *opts, { "undefined", SANITIZE_UNDEFINED, sizeof "undefined" - 1 }, { "unreachable", SANITIZE_UNREACHABLE, sizeof "unreachable" - 1 }, + { "vla-bound", SANITIZE_VLA, sizeof "vla-bound" - 1 }, { NULL, 0, 0 } }; const char *comma; |