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

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
For TSAN, any optimization that hoists loads like that after the tsan/tsan0
passes doesn't really matter and for those that do happen before the
possibilities are either to disable those optimizations when being asked for
SANITIZE_THREAD instrumentation, or mark such loads some special way so that
the tsan/tsan0 passes would consider them as speculative.  Disabling those
optimizations seems far easier IMHO.
For valgrind, I think it is valgrind that when seeing these load vs. store
races actually checks if the load is actually used.  It certainly wouldn't be
the first place
where it does something like that, we already have e.g. vectorization which can
load from some bytes after an end of malloced area or other ends of an object
and it matters if bits from those bytes are ever used later or not.

Reply via email to