Commit
266614a3
authored
by
Committed by
swiftshader-scoped@luci-project-accounts.iam.gserviceaccount.com
Fix crash during llvm_shutdown due to init order fiasco
Use the constexpr constructor for _MSC_VER >= 1925, otherwise
ManagedStatic will have a dynamic initializer, which depending on init
order, results in the Ptr field being overwritten with 0. This
eventually leads to multiple instances of the same ManagedStatic
instance in the StaticList, and asserts when double destroying during
llvm_shutdown.
I reported this bug [here](https://bugs.llvm.org/show_bug.cgi?id=49027),
and learned that this bug had already been fixed in upstream LLVM.
Note that llvm_subzero already has a similar change, though for _MSC_VER
>= 1920. According to the LLVM comment, the VC++ compiler up until 1925
may still emit a dynamic initializer for a constexpr constructor, but I
suppose we never ran into that for Subzero, so I'll leave this as is.
Bug: b/175782868
Change-Id: Ice3944f67e496aa94f1a7ed7502b49e763d702b4
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/52508
Kokoro-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by:
Alexis Hétu <sugoi@google.com>
Tested-by:
Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Showing
Please
register
or
sign in
to comment