http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55309
--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-06
12:39:21 UTC ---
(In reply to comment #17)
> Trying this patch:
> % cat inc.cc
> void foo(int *a) {
> (*a)++;
> }
> % gcc -fsanitize=address -O2 inc.cc -S -o - | grep __asan_report
> call __asan_report_load4
> call __asan_report_store4
> % clang -fsanitize=address -O2 inc.cc -S -o - | grep __asan_report
> callq __asan_report_load4
> %
The clang variant looks incorrect to me - if asan distinguishes between
loads and stores the __asan_report_load4 should have been promoted to
a __asan_report_store4. Consider a pointing to read-only memory.
Or rather asan would need a __asan_report_load_store4 to be really correct.
> Is this test expected to work (have one __asan_error call) with this patch?
>
> (I've checked that the patch is applied correctly, on
> gcc/testsuite/c-c++-common/asan/no-redundant-instrumentation-1.c
> it reduces the number of calls from 16 to 5)