Commit d51151b2 by Jakub Jelinek Committed by Jakub Jelinek

re PR sanitizer/64981 (-fsanitize=address cant expand __builtin_ia32_rdtsc)

	PR sanitizer/64981
	* builtins.c (expand_builtin): Call targetm.expand_builtin
	for BUILT_IN_MD builtins regardless of asan_intercepted_p.

	* gcc.dg/asan/pr64981.c: New test.

From-SVN: r220551
parent c3e38a03
2015-02-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/64981
* builtins.c (expand_builtin): Call targetm.expand_builtin
for BUILT_IN_MD builtins regardless of asan_intercepted_p.
2015-02-08 Jan Hubicka <hubicka@ucw.cz> 2015-02-08 Jan Hubicka <hubicka@ucw.cz>
PR ipa/61548 PR ipa/61548
......
...@@ -5960,6 +5960,9 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, ...@@ -5960,6 +5960,9 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
machine_mode target_mode = TYPE_MODE (TREE_TYPE (exp)); machine_mode target_mode = TYPE_MODE (TREE_TYPE (exp));
int flags; int flags;
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
/* When ASan is enabled, we don't want to expand some memory/string /* When ASan is enabled, we don't want to expand some memory/string
builtins and rely on libsanitizer's hooks. This allows us to avoid builtins and rely on libsanitizer's hooks. This allows us to avoid
redundant checks and be sure, that possible overflow will be detected redundant checks and be sure, that possible overflow will be detected
...@@ -5968,9 +5971,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode, ...@@ -5968,9 +5971,6 @@ expand_builtin (tree exp, rtx target, rtx subtarget, machine_mode mode,
if ((flag_sanitize & SANITIZE_ADDRESS) && asan_intercepted_p (fcode)) if ((flag_sanitize & SANITIZE_ADDRESS) && asan_intercepted_p (fcode))
return expand_call (exp, target, ignore); return expand_call (exp, target, ignore);
if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_MD)
return targetm.expand_builtin (exp, target, subtarget, mode, ignore);
/* When not optimizing, generate calls to library functions for a certain /* When not optimizing, generate calls to library functions for a certain
set of builtins. */ set of builtins. */
if (!optimize if (!optimize
......
2015-02-09 Jakub Jelinek <jakub@redhat.com>
PR sanitizer/64981
* gcc.dg/asan/pr64981.c: New test.
2015-02-09 Marek Polacek <polacek@redhat.com> 2015-02-09 Marek Polacek <polacek@redhat.com>
PR c/64856 PR c/64856
......
/* PR sanitizer/64981 */
/* { dg-do compile { target { i?86-*-* x86_64-*-* } } } */
/* { dg-options "-fsanitize=address -march=x86-64" } */
int
main ()
{
__builtin_ia32_rdtsc ();
return 0;
}
/* { dg-final { scan-assembler-not "__builtin_ia32_rdtsc" } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment