aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgcleanup.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-12-11 11:28:35 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-12-11 11:28:35 +0100
commit68a9738af04f4c9fdf37aa48cf16b535eef16c46 (patch)
tree007614e41453c6215b782fce18607934e878b4f2 /gcc/cfgcleanup.c
parent2b2571c99c923e306bd322533baac4ed4a3b603c (diff)
downloadgcc-68a9738af04f4c9fdf37aa48cf16b535eef16c46.zip
gcc-68a9738af04f4c9fdf37aa48cf16b535eef16c46.tar.gz
gcc-68a9738af04f4c9fdf37aa48cf16b535eef16c46.tar.bz2
sanitizer.def: Add comment about importance of ordering of BUILT_IN_ASAN_REPORT* builtins.
* sanitizer.def: Add comment about importance of ordering of BUILT_IN_ASAN_REPORT* builtins. * cfgcleanup.c (old_insns_match_p): Don't cross-jump __asan_report_* builtins. From-SVN: r194391
Diffstat (limited to 'gcc/cfgcleanup.c')
-rw-r--r--gcc/cfgcleanup.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/cfgcleanup.c b/gcc/cfgcleanup.c
index 94267b6e..5d142e9 100644
--- a/gcc/cfgcleanup.c
+++ b/gcc/cfgcleanup.c
@@ -1138,6 +1138,28 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx i1, rtx i2)
CALL_INSN_FUNCTION_USAGE (i2))
|| SIBLING_CALL_P (i1) != SIBLING_CALL_P (i2))
return dir_none;
+
+ /* For address sanitizer, never crossjump __asan_report_* builtins,
+ otherwise errors might be reported on incorrect lines. */
+ if (flag_asan)
+ {
+ rtx call = get_call_rtx_from (i1);
+ if (call && GET_CODE (XEXP (XEXP (call, 0), 0)) == SYMBOL_REF)
+ {
+ rtx symbol = XEXP (XEXP (call, 0), 0);
+ if (SYMBOL_REF_DECL (symbol)
+ && TREE_CODE (SYMBOL_REF_DECL (symbol)) == FUNCTION_DECL)
+ {
+ if ((DECL_BUILT_IN_CLASS (SYMBOL_REF_DECL (symbol))
+ == BUILT_IN_NORMAL)
+ && DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
+ >= BUILT_IN_ASAN_REPORT_LOAD1
+ && DECL_FUNCTION_CODE (SYMBOL_REF_DECL (symbol))
+ <= BUILT_IN_ASAN_REPORT_STORE16)
+ return dir_none;
+ }
+ }
+ }
}
#ifdef STACK_REGS