This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [asan] Patch - fix an ICE in asan.c
- From: Tobias Burnus <burnus at net-b dot de>
- To: Dodji Seketeli <dodji at redhat dot com>
- Cc: gcc patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Wei Mi <wmi at google dot com>, Kostya Serebryany <kcc at google dot com>, Xinliang David Li <davidxl at google dot com>
- Date: Mon, 12 Nov 2012 16:45:55 +0100
- Subject: Re: [asan] Patch - fix an ICE in asan.c
- References: <509D6965.5040405@net-b.de> <874nkv3up1.fsf@redhat.com>
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.)
--- invoke.texi.orig 2012-11-12 15:41:31.000000000 +0100
+++ invoke.texi 2012-11-12 15:16:33.856424039 +0100
@@ -356,5 +356,5 @@ Objective-C and Objective-C++ Dialects}.
-falign-labels[=@var{n}] -falign-loops[=@var{n}] -faddress-sanitizer @gol
---fassociative-math fauto-inc-dec -fbranch-probabilities @gol
---fbranch-target-load-optimize fbranch-target-load-optimize2 @gol
---fbtr-bb-exclusive -fcaller-saves @gol
+-fassociative-math -fauto-inc-dec -fbranch-probabilities @gol
+-fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
+-fbtr-bb-exclusive -fcaller-saves @gol
-fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
* * *
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));