https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70541
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2016-04-05
CC| |marxin at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
At -O0 indeed the dereferences in function argument list are not instrumented:
[ab.c:24:3] _7 = f ([ab.c:24:3] *psimple_3);
doesn't have corresponding ASAN_CHECK added.
At -O2, everything is reported, but there is another issue, we lose the
location
of the first read - before einline we have:
[ab.c:24:3] _7 = f ([ab.c:24:3] *psimple_3);
[ab.c:24:3] __builtin_printf ([ab.c:24:21] "%d\n", _7);
but after einline:
simple = [ab.c:24:3] *psimple_3;
[ab.c:8:16] _14 = [ab.c:8:16] simple.value;
_18 = _14;
[ab.c:24:3] _7 = _18;
[ab.c:24:3] __builtin_printf ([ab.c:24:21] "%d\n", _7);
as the simple = *psimple_3; statement has gimple_location UNKNOWN_LOCATION,
we actually end up reporting it at the spot of the second invalid memory access
(because it inherits the location from the previous statement, which is the
other __asan_report_store4 call). In this case, we could either also look at
EXPR_LOCATION of the MEM_REF if gimple_location is UNKNOWN_LOCATION, or we'd
need to look at the inliner and figure out what location we want for the
parameter read.