https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112965

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
It could be done just for #ifdef ENABLE_VALGRIND_ANNOTATIONS
Perhaps { const char buf[16] = {}; pp_append_text (pp, buf, buf + 16); } ?
Anyway, I'm really curious why it works for buffers in libcpp.
Because new_buff only aligns length to DEFAULT_ALIGNMENT, which is alignment of
double and pointers; 8 bytes on x86-64, but just 4 bytes on i686.
Obviously, when not under valgrind I think it should be ok in any case, even
when reading random uninitialized bytes after the allocation it shouldn't
change anything on the outcome of the search, and because e.g. the sse4.2
version for < 16 bytes misaligned at the end of page defers to sse2 version and
otherwise does one unaligned load and all the further ones are aligned, so it
should never cross the end of page.
So it is just about valgrind not understanding that the uninitialized bytes
after newline don't matter.

Reply via email to