Work around MemorySanitizer false-positive
The initialization of static thread-local data is not observed by
MemorySanitizer when inside a shared library, leading to false-positive
use-of-uninitialized-data errors:
https://github.com/google/sanitizers/issues/1409
We work around this by assigning an initial value to it ourselves on
first use. Note that since the flag to check whether this
initialization has already been done is itself a static thread-local,
we must suppress the MemorySanitizer check with a function attribute.
Bug: b/191050320
Change-Id: I356a89f90ff099e08a12f5562e0545ed14d93ee3
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/55328Tested-by:
Nicolas Capens <nicolascapens@google.com>
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Corentin Wallez <cwallez@google.com>
Showing
Please
register
or
sign in
to comment