http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c File gcc/tree-tsan.c (right):
http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode432 gcc/tree-tsan.c:432: /* Builds either (__tsan_shadow_stack += 1) or (__tsan_shadow_stack -= 1) expression Line too long. http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode464 gcc/tree-tsan.c:464: /* Builds either (__tsan_thread_ignore += 1) or (__tsan_thread_ignore -= 1) expression Long line. http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode623 gcc/tree-tsan.c:623: && strcmp (decl_name (cfun->decl), "__base_dtor ") == 0) How about inline instance of dtor? http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode625 gcc/tree-tsan.c:625: tree comp = expr->exp.operands [0]; Use TREE_OPERAND http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode627 gcc/tree-tsan.c:627: comp = comp->exp.operands [0]; Use TREE_OPERAND http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode631 gcc/tree-tsan.c:631: if (TREE_CODE (comp) == SSA_NAME) All the above can be simplified using get_base_addr http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode638 gcc/tree-tsan.c:638: "_vptr.", sizeof ("_vptr.") - 1) == 0) This is a very hacky way of recognizing vptr field. C++ FE provides TYPE_VFIELD macro to get the vptr field, but you will need to add a new langhook for it -- which is not liked in upstream -- so the hacky way may be ok (as it is for error checking purpose). http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode646 gcc/tree-tsan.c:646: /* Checks as to whether expr refers to a read from vtlb. vtlb -- vtbl. http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode663 gcc/tree-tsan.c:663: tree ref_target = expr->exp.operands [0]; TREE_OPERAND http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode666 gcc/tree-tsan.c:666: gimple ref_stmt = ref_target->ssa_name.def_stmt; Use SSA_NAME_DEF_STMT http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode685 gcc/tree-tsan.c:685: } Please refactor the is_dtor_vtpr_store code above for a new utility function -- is_vptr_access. http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode900 gcc/tree-tsan.c:900: { Remove {} http://codereview.appspot.com/5303083/diff/1/gcc/tree-tsan.c#newcode911 gcc/tree-tsan.c:911: bbd->has_sb = 0; Where is the code that instrument function calls? http://codereview.appspot.com/5303083/