http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55341
--- Comment #18 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-12-19 08:42:40 UTC --- (In reply to comment #16) > After testing on CP2K, I believe that ASAN yields a false positive (current > trunk). It is obviously hard to be sure, but the indications are > > First, the code and testcase runs without error with valgrind (when compiled > without -fsanitize=address). Those are very weak indications. Valgrind doesn't report out of bounds array accesses on the stack and similar errors (unless they are uninitialized stack area reads + use of that uninitialized data), asan does. > Second, the error happens after the last statement in the subroutine and is of > 'unknown' type > Third, the invalid write has size 1, which is a very unusual length in > Fortran, > as almost no data types have that length. And this is no reason at all, for most string/memory intrinsics asan instruments them just by pretending they are writes (resp. reads or both) from the first and last byte of the area, i.e. with size 1. The backtrace clearly shows that it is memset.