fasan option also needs to be documented in doc/invoke.texi.
http://codereview.appspot.com/5272048/diff/2001/tree-asan.c File tree-asan.c (right): http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode54 tree-asan.c:54: ShadowValue = (char*)ShadowAddr; *(char*) ShadowAddr; http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode59 tree-asan.c:59: ShadowValue = (char*)ShadowAddr; *(char*) ShadowAddr; http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode79 tree-asan.c:79: (All I need is to traverse *all* memory accesses and instrument them). Two suggestions: 1) You only need to deal with GIMPLE_ASSIGN (lhs and rhs) for all memory references) 2) use get_base_address function to compute base address. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode89 tree-asan.c:89: We may want to add command line flags to change these values. */ two spaces. Similarly for other comments. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode90 tree-asan.c:90: static int asan_scale = 3; Need an empty line after the comment. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode91 tree-asan.c:91: static int asan_offset_log_32 = 29; const int? http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode97 tree-asan.c:97: static tree New empty line after the comment. Similarly for all other functions in the file. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode98 tree-asan.c:98: report_error_func (int is_store, int size) Document IS_STORE and SIZE in the comment. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode102 tree-asan.c:102: Extra line. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode104 tree-asan.c:104: sprintf(name, "__asan_report_%s%d\n", is_store ? "store" : "load", size); Empty line between decls and statements. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode108 tree-asan.c:108: DECL_ATTRIBUTES (def) = tree_cons (get_identifier ("leaf"), NULL, DECL_ATTRIBUTES (def)); line too long. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode128 tree-asan.c:128: /* perform the instrumentation */ Parameter documentation. s/perform/Perform/ http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode154 tree-asan.c:154: if (! gsi_end_p (gsi)) remove extra space http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode187 tree-asan.c:187: base_addr = make_rename_temp (uintptr_type, "base_addr"); May be better "__asan_base_addr" as the temp var name? http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode199 tree-asan.c:199: build_int_cst(uintptr_type, asan_scale) Missing space after function name. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode200 tree-asan.c:200: ); Do not put closing parenthesis in a separate line. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode203 tree-asan.c:203: build_int_cst(uintptr_type, 1), Missing space. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode204 tree-asan.c:204: build_int_cst(uintptr_type, asan_offset_log) Missing space. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode205 tree-asan.c:205: ) Do not start a new line. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode230 tree-asan.c:230: { { } is not needed. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode237 tree-asan.c:237: cond = make_rename_temp (boolean_type_node, "asan_crash_cond"); -> __asan_crash_cond to be consistent. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode238 tree-asan.c:238: g = gimple_build_assign (cond, t); Extra space here. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode251 tree-asan.c:251: g = gimple_build_call (report_error_func(is_store, size), 1, base_addr); Missing space. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode254 tree-asan.c:254: Extra line. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode286 tree-asan.c:286: transform_derefs (gimple_stmt_iterator *iter, tree *tp, You can use get_base_address utility function defined in gimple.c http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode414 tree-asan.c:414: do Can you use FOR_EACH_BB macro? http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode425 tree-asan.c:425: transform_derefs (&i, gimple_assign_lhs_ptr (s), Use get_base_address and then do transformation. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode436 tree-asan.c:436: if (gimple_return_retval (s) != NULL_TREE) The operand of a gimple_return should be a SSA_NAME, so handling it is not needed. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode447 tree-asan.c:447: if (fndecl && (DECL_FUNCTION_CODE (fndecl) == BUILT_IN_ALLOCA)) && DECL_BUILT_IN (fndecl) .. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode469 tree-asan.c:469: append_to_statement_list (build_call_expr (asan_init_func(), 0), missing space. http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode472 tree-asan.c:472: MAX_RESERVED_INIT_PRIORITY-1); missing space around '-' http://codereview.appspot.com/5272048/diff/2001/tree-asan.c#newcode481 tree-asan.c:481: int is_64 = tree_to_double_int (TYPE_SIZE(uintptr_type)).low == 64; tree_low_cst (..) http://codereview.appspot.com/5272048/