This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Fri, Nov 09, 2012 at 09:36:53PM +0100, Tobias Burnus wrote:
> * I still have to do an all-language bootstrap and regtesting,
> though the latter is probably pointless as there is currently not a
> single -fasan test case.

> --- gcc/asan.c.orig	2012-11-09 21:26:26.000000000 +0100
> +++ gcc/asan.c	2012-11-09 21:26:00.000000000 +0100
> @@ -1362,6 +1362,8 @@ transform_statements (void)
>  	    instrument_assignment (&i);
>  	  else if (is_gimple_call (s))
>  	    maybe_instrument_call (&i);
> +	  if (gsi_end_p (i))
> +	    break;
>          }
>      }
>  }

That looks a wrong place for this.  Instead, maybe_instrument_call
should ensure that *iter is set to the last stmt that shouldn't be
instrumented.  instrument_derefs does that correctly, so assignments and
__atomic/__sync builtins should be correct (*iter is set to the
assignment/call), for strlen call it seems to DTRT, but for other builtin
calls it would leave *iter elsewhere.  As we want to scan for accesses
the rest of the bb that contained the call (but that bb after splitting
already is above the highest bb number to be insturmented), we
need to keep *iter at the call we just processed, so if there are say
two consecutive calls the second one is going to be processed.

So untested:

2012-11-10  Jakub Jelinek  <jakub@redhat.com>

	* asan.c (maybe_instrument_builtin_call): Set *iter
	to gsi for the call at the end.

--- gcc/asan.c.jj	2012-11-02 00:09:22.000000000 +0100
+++ gcc/asan.c	2012-11-10 10:00:03.717715834 +0100
@@ -1191,6 +1191,7 @@ maybe_instrument_builtin_call (gimple_st
       else if (dest != NULL_TREE)
 	instrument_mem_region_access (dest, len, iter,
 				      loc, /*is_store=*/true);
+      *iter = gsi_for_stmt (call);
       return true;
     }
   return false;


	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]