https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79572
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Author: jakub Date: Fri May 5 21:49:20 2017 New Revision: 247694 URL: https://gcc.gnu.org/viewcvs?rev=247694&root=gcc&view=rev Log: Backported from mainline 2017-03-31 Jakub Jelinek <ja...@redhat.com> PR c++/79572 * c-ubsan.h (ubsan_maybe_instrument_reference): Change argument to tree *. * c-ubsan.c (ubsan_maybe_instrument_reference): Likewise. Handle not just NOP_EXPR to REFERENCE_TYPE, but also INTEGER_CST with REFERENCE_TYPE. * cp-gimplify.c (cp_genericize_r): Sanitize INTEGER_CSTs with REFERENCE_TYPE. Adjust ubsan_maybe_instrument_reference caller for NOP_EXPR to REFERENCE_TYPE. * g++.dg/ubsan/null-8.C: New test. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/ubsan/null-8.C Modified: branches/gcc-6-branch/gcc/c-family/ChangeLog branches/gcc-6-branch/gcc/c-family/c-ubsan.c branches/gcc-6-branch/gcc/c-family/c-ubsan.h branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/cp-gimplify.c branches/gcc-6-branch/gcc/testsuite/ChangeLog