From patchwork Mon Nov 12 15:45:55 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [asan] Patch - fix an ICE in asan.c Date: Mon, 12 Nov 2012 05:45:55 -0000 From: Tobias Burnus X-Patchwork-Id: 198414 Message-Id: <50A119B3.4000201@net-b.de> To: Dodji Seketeli Cc: gcc patches , Jakub Jelinek , Wei Mi , Kostya Serebryany , Xinliang David Li Dodji Seketeli wrote: > I believe the neqw series of patches I have juste posted address this > issue. Thanks a lot for your merging work! I am really looking forward to have it available on the trunk! I guess that your updated patch fixes the issue as it incorporates Jakub's patch. (I have not yet re-build your merge branch but have just applied Jakub's patch to the "asan" branch. Cloning your merge branch takes quite some time and due to --rebase, a simple "git update" doesn't work.) * * * I have two minor issues which can be fixed after committal of the patches to the trunk. First, I have a small hyphen fix patch, which is on top of your merge branch. (The "asan" branch itself is okay.) * * * Secondly, the following code fails on both the asan branch and on the merge branch with an ICE: void TI_ASM_Pack_Inst (const int *opnd) { int bopnd[5]; __builtin_bcopy(opnd, bopnd, sizeof (bopnd)); } The ICE is: fail7.i:1:6: error: type mismatch in pointer plus expression _40 = _39 + _38; as the operands aren't POINTER_P. That's fixed by the following patch; I am not sure whether it is fully correct, but that patched line is used for both pointers and nonpointers in *this* example. Tobias diff --git a/gcc/asan.c b/gcc/asan.c index 639dd9f..42f1abe 100644 --- a/gcc/asan.c +++ b/gcc/asan.c @@ -928,7 +928,8 @@ instrument_mem_region_access (tree base, tree len, /* _2 = _1 + offset; */ region_end = - gimple_build_assign_with_ops (POINTER_PLUS_EXPR, + gimple_build_assign_with_ops (POINTER_TYPE_P (TREE_TYPE (base)) + ? POINTER_PLUS_EXPR : PLUS_EXPR, make_ssa_name (TREE_TYPE (base), NULL), gimple_assign_lhs (region_end), gimple_assign_lhs (offset));