From 71c581e77d0da68c1364fa14ae06402bd8f44cc8 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 3 Apr 2013 16:01:38 +0000 Subject: [PATCH] re PR sanitizer/55702 (ICE: in instrument_func_exit, at tsan.c:684 with -fsanitize=thread and __builtin_return()) PR sanitizer/55702 * tsan.c (instrument_func_exit): Allow BUILT_IN_RETURN functions. * gcc.dg/pr55702.c: New test. From-SVN: r197430 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr55702.c | 9 +++++++++ gcc/tsan.c | 3 ++- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr55702.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ce142c7707..7d86b286809 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2013-04-03 Marek Polacek + + PR sanitizer/55702 + * tsan.c (instrument_func_exit): Allow BUILT_IN_RETURN + functions. + 2013-04-03 Kyrylo Tkachov PR target/56809 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5e64fa68db9..b5530fe75ad 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-03 Marek Polacek + + PR sanitizer/55702 + * gcc.dg/pr55702.c: New test. + 2013-04-03 Kyrylo Tkachov PR target/56809 diff --git a/gcc/testsuite/gcc.dg/pr55702.c b/gcc/testsuite/gcc.dg/pr55702.c new file mode 100644 index 00000000000..8770a3758d7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr55702.c @@ -0,0 +1,9 @@ +/* PR sanitizer/55702 */ +/* { dg-do compile { target { x86_64-*-linux* && lp64 } } } */ +/* { dg-options "-fsanitize=thread" } */ + +void +foo () +{ + __builtin_return (0); +} diff --git a/gcc/tsan.c b/gcc/tsan.c index 14f40ce99ff..c02e100cca0 100644 --- a/gcc/tsan.c +++ b/gcc/tsan.c @@ -681,7 +681,8 @@ instrument_func_exit (void) { gsi = gsi_last_bb (e->src); stmt = gsi_stmt (gsi); - gcc_assert (gimple_code (stmt) == GIMPLE_RETURN); + gcc_assert (gimple_code (stmt) == GIMPLE_RETURN + || gimple_call_builtin_p (stmt, BUILT_IN_RETURN)); loc = gimple_location (stmt); builtin_decl = builtin_decl_implicit (BUILT_IN_TSAN_FUNC_EXIT); g = gimple_build_call (builtin_decl, 0); -- 2.11.4.GIT