re PR sanitizer/55702 (ICE: in instrument_func_exit, at tsan.c:684 with -fsanitize...
authorMarek Polacek <polacek@redhat.com>
Wed, 3 Apr 2013 16:01:38 +0000 (16:01 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 3 Apr 2013 16:01:38 +0000 (16:01 +0000)
PR sanitizer/55702
* tsan.c (instrument_func_exit): Allow BUILT_IN_RETURN
functions.

* gcc.dg/pr55702.c: New test.

From-SVN: r197430

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr55702.c [new file with mode: 0644]
gcc/tsan.c

index 9ce142c..7d86b28 100644 (file)
@@ -1,3 +1,9 @@
+2013-04-03  Marek Polacek  <polacek@redhat.com>
+
+       PR sanitizer/55702
+       * tsan.c (instrument_func_exit): Allow BUILT_IN_RETURN
+       functions.
+
 2013-04-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/56809
index 5e64fa6..b5530fe 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-03  Marek Polacek  <polacek@redhat.com>
+
+       PR sanitizer/55702
+       * gcc.dg/pr55702.c: New test.
+
 2013-04-03  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/56809
diff --git a/gcc/testsuite/gcc.dg/pr55702.c b/gcc/testsuite/gcc.dg/pr55702.c
new file mode 100644 (file)
index 0000000..8770a37
--- /dev/null
@@ -0,0 +1,9 @@
+/* PR sanitizer/55702 */
+/* { dg-do compile { target { x86_64-*-linux* && lp64 } } } */
+/* { dg-options "-fsanitize=thread" } */
+
+void
+foo ()
+{
+  __builtin_return (0);
+}
index 14f40ce..c02e100 100644 (file)
@@ -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);