gcc/libsanitizer/ubsan
Jakub Jelinek c9b39a4955 re PR sanitizer/80998 (Implement -fsanitize=pointer-overflow)
PR sanitizer/80998
	* sanopt.c (pass_sanopt::execute): Handle IFN_UBSAN_PTR.
	* tree-ssa-alias.c (call_may_clobber_ref_p_1): Likewise.
	* flag-types.h (enum sanitize_code): Add SANITIZER_POINTER_OVERFLOW.
	Or it into SANITIZER_UNDEFINED.
	* ubsan.c: Include gimple-fold.h and varasm.h.
	(ubsan_expand_ptr_ifn): New function.
	(instrument_pointer_overflow): New function.
	(maybe_instrument_pointer_overflow): New function.
	(instrument_object_size): Formatting fix.
	(pass_ubsan::execute): Call instrument_pointer_overflow
	and maybe_instrument_pointer_overflow.
	* internal-fn.c (expand_UBSAN_PTR): New function.
	* ubsan.h (ubsan_expand_ptr_ifn): Declare.
	* sanitizer.def (__ubsan_handle_pointer_overflow,
	__ubsan_handle_pointer_overflow_abort): New builtins.
	* tree-ssa-tail-merge.c (merge_stmts_p): Handle IFN_UBSAN_PTR.
	* internal-fn.def (UBSAN_PTR): New internal function.
	* opts.c (sanitizer_opts): Add pointer-overflow.
	* lto-streamer-in.c (input_function): Handle IFN_UBSAN_PTR.
	* fold-const.c (build_range_check): Compute pointer range check in
	integral type if pointer arithmetics would be needed.  Formatting
	fixes.
gcc/testsuite/
	* c-c++-common/ubsan/ptr-overflow-1.c: New test.
	* c-c++-common/ubsan/ptr-overflow-2.c: New test.
libsanitizer/
	* ubsan/ubsan_handlers.cc: Cherry-pick upstream r304461.
	* ubsan/ubsan_checks.inc: Likewise.
	* ubsan/ubsan_handlers.h: Likewise.

From-SVN: r250656
2017-07-28 12:37:51 +02:00
..
libtool-version
Makefile.am re PR other/79046 (g++ -print-file-name=plugin uses full version number in path) 2017-01-21 09:47:11 +01:00
Makefile.in re PR other/79046 (g++ -print-file-name=plugin uses full version number in path) 2017-01-21 09:47:11 +01:00
ubsan_checks.inc re PR sanitizer/80998 (Implement -fsanitize=pointer-overflow) 2017-07-28 12:37:51 +02:00
ubsan_diag.cc
ubsan_diag.h
ubsan_flags.cc
ubsan_flags.h
ubsan_flags.inc
ubsan_handlers_cxx.cc
ubsan_handlers_cxx.h
ubsan_handlers.cc re PR sanitizer/80998 (Implement -fsanitize=pointer-overflow) 2017-07-28 12:37:51 +02:00
ubsan_handlers.h re PR sanitizer/80998 (Implement -fsanitize=pointer-overflow) 2017-07-28 12:37:51 +02:00
ubsan_init_standalone.cc
ubsan_init.cc
ubsan_init.h
ubsan_platform.h
ubsan_type_hash_itanium.cc
ubsan_type_hash_win.cc
ubsan_type_hash.cc
ubsan_type_hash.h
ubsan_value.cc
ubsan_value.h