[asan] Patch - fix an ICE in asan.c

Message ID 50A119B3.4000201@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Nov. 12, 2012, 3:45 p.m.
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 

  * * *

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.



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))
 				  make_ssa_name (TREE_TYPE (base), NULL),
 				  gimple_assign_lhs (region_end), 
 				  gimple_assign_lhs (offset));