https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81530
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Author: marxin Date: Mon Jul 31 08:53:00 2017 New Revision: 250730 URL: https://gcc.gnu.org/viewcvs?rev=250730&root=gcc&view=rev Log: Do UBSAN sanitization just when current_function_decl != NULL_TREE (PR sanitize/81530). 2017-07-31 Martin Liska <mli...@suse.cz> PR sanitize/81530 * cp-gimplify.c (cp_genericize): Guard condition with flag_sanitize_p also with current_function_decl non-null equality. * cp-ubsan.c (cp_ubsan_instrument_vptr_p): Likewise. * decl.c (compute_array_index_type): Likewise. * init.c (finish_length_check): Likewise. * typeck.c (cp_build_binary_op): Likewise. 2017-07-31 Martin Liska <mli...@suse.cz> PR sanitize/81530 * c-convert.c (convert): Guard condition with flag_sanitize_p also with current_function_decl non-null equality. * c-decl.c (grokdeclarator): Likewise. * c-typeck.c (build_binary_op): Likewise. 2017-07-31 Martin Liska <mli...@suse.cz> PR sanitize/81530 * convert.c (convert_to_integer_1): Guard condition with flag_sanitize_p also with current_function_decl non-null equality. 2017-07-31 Martin Liska <mli...@suse.cz> PR sanitize/81530 * c-ubsan.c (ubsan_maybe_instrument_array_ref): Guard condition with flag_sanitize_p also with current_function_decl non-null equality. (ubsan_maybe_instrument_reference_or_call): Likewise. 2017-07-31 Martin Liska <mli...@suse.cz> PR sanitize/81530 * g++.dg/ubsan/pr81530.C: New test. Added: trunk/gcc/testsuite/g++.dg/ubsan/pr81530.C Modified: trunk/gcc/ChangeLog trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-ubsan.c trunk/gcc/c/ChangeLog trunk/gcc/c/c-convert.c trunk/gcc/c/c-decl.c trunk/gcc/c/c-typeck.c trunk/gcc/convert.c trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-gimplify.c trunk/gcc/cp/cp-ubsan.c trunk/gcc/cp/decl.c trunk/gcc/cp/init.c trunk/gcc/cp/typeck.c trunk/gcc/testsuite/ChangeLog