https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109446
--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Martin Liška from comment #3) > The problem here is that we normally preserve memcpy calls and then > __interceptor_memcpy is used from the run-time library. However, in this > case the second argument of memcpy is a known constant and we convert it to: > MEM <unsigned char[64]> [(char * {ref-all})_7] = MEM <unsigned char[64]> > [(char * {ref-all})&txt]; > > for such an assignment we only check the beginning and the end of the chunk > and we miss the overflow. It seems Clang disables this optimization and convert memcpy to __asan_memcpy calls if -fsanitize=address used: https://godbolt.org/z/dcfadoMYY