This is for google-main branch.
Fix taking address of SSA_NAME in ThreadSanitizer pass.

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  <dvyu...@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  <dvyu...@google.com>
 
        Add directives to run ThreadSanitizer tests

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

Reply via email to