diff mbox

Fix a bug in ThreadSanitizer pass (issue5448109)

Message ID 20111205170514.CDB44C1C49@1024cores.msk.corp.google.com
State New
Headers show

Commit Message

Dmitry Vyukov Dec. 5, 2011, 5:05 p.m. UTC
This is for google-main branch.
Fix taking address of SSA_NAME in ThreadSanitizer pass.


--
This patch is available for review at http://codereview.appspot.com/5448109
diff mbox

Patch

Index: gcc/tree-tsan.c
===================================================================
--- gcc/tree-tsan.c	(revision 182014)
+++ gcc/tree-tsan.c	(working copy)
@@ -726,13 +726,20 @@ 
   struct mop_desc mop;
   unsigned fld_off;
   unsigned fld_size;
+  tree base;
 
+
+  base = get_base_address (expr);
+  if (base == NULL_TREE
+      || TREE_CODE (base) == SSA_NAME
+      || TREE_CODE (base) == STRING_CST)
+    return;
+
   tcode = TREE_CODE (expr);
 
   /* Below are things we do not instrument
      (no possibility of races or not implemented yet).  */
   if ((func_ignore & (tsan_ignore_mop | tsan_ignore_rec))
-      || get_base_address (expr) == NULL
       /* Compiler-emitted artificial variables.  */
       || (DECL_P (expr) && DECL_ARTIFICIAL (expr))
       /* The var does not live in memory -> no possibility of races.  */
Index: gcc/ChangeLog.google-main
===================================================================
--- gcc/ChangeLog.google-main	(revision 182014)
+++ gcc/ChangeLog.google-main	(working copy)
@@ -1,3 +1,8 @@ 
+2011-12-05   Dmitriy Vyukov  <dvyukov@google.com>
+
+	Fix taking address of SSA_NAME in ThreadSanitizer pass.
+        * gcc/tree-tsan.c (handle_expr): Add the additional check.
+
 2011-11-30   Dmitriy Vyukov  <dvyukov@google.com>
 
 	Add directives to run ThreadSanitizer tests