This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Don't instrument with -fsanitize=thread accesses to DECL_HARD_REGISTER vars (PR tree-optimization/57104)


Hi!

DECL_HARD_REGISTER vars don't live in memory, thus they can't be
addressable.

The following patch fixes the ICE, ok for trunk/4.8?

2013-04-29  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/57104
	* tsan.c (instrument_expr): Don't instrument accesses to
	DECL_HARD_REGISTER VAR_DECLs.

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

--- gcc/tsan.c.jj	2013-04-24 12:07:12.000000000 +0200
+++ gcc/tsan.c	2013-04-29 21:06:48.975888478 +0200
@@ -128,7 +128,9 @@ instrument_expr (gimple_stmt_iterator gs
 	return false;
     }
 
-  if (TREE_READONLY (base))
+  if (TREE_READONLY (base)
+      || (TREE_CODE (base) == VAR_DECL
+	  && DECL_HARD_REGISTER (base)))
     return false;
 
   if (size == 0
--- gcc/testsuite/gcc.dg/pr57104.c.jj	2013-04-29 21:09:46.812948131 +0200
+++ gcc/testsuite/gcc.dg/pr57104.c	2013-04-29 21:09:39.000000000 +0200
@@ -0,0 +1,12 @@
+/* PR tree-optimization/57104 */
+/* { dg-do compile { target { x86_64-*-linux* && lp64 } } } */
+/* { dg-options "-fsanitize=thread" } */
+
+register int r asm ("r14");
+int v;
+
+int
+foo (void)
+{
+  return r + v;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]