[PATCH] Support asan-instrumentation-with-call-threshold in GCC (second try)

Jakub Jelinek jakub@redhat.com
Fri Jun 6 06:02:00 GMT 2014


On Fri, Jun 06, 2014 at 09:08:17AM +0400, Yury Gribov wrote:
> Build_check_stmt is now unified for const/variable lengths
> but I'd still prefer to treat the use_calls case specially
> because calling single __asan_loadN is more space-efficient
> than emitting two separate calls with a length check.

That is not what I meant.
1) instrument_mem_region_access/instrument_strlen should use a single
   build_check_stmt call instead of two that they do now,
   both for use_calls case and !use_calls case, the difference
   is just that instrument_mem_region_access needs to guard
   it against len == 0, while for use_calls it doesn't have to,
   it seems __asan_{load,store}N handles length of 0 correctly
   (still, the caller shouldn't update_mem_ref_hash_table
   if length might be zero, even in the use_calls case)
2) passing always a tree length to build_check_stmt and then
   recreating size_in_bytes out of it is ugly, just add a new
   tree parameter, if it is non-NULL, the length is variable,
   and real_size_in_bytes should be 1, and the code additionally
   has to compute length - 1 at runtime and add the result,
   otherwise it just keeps adding precomputed constant

	Jakub



More information about the Gcc-patches mailing list