-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Runtime: add a workaround for Windows ARM64 #25960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Unfortunately, `std::atomic` in msvcprt as of 14.21.27702 is broken for double-width atomics on ARM64. This has been reported to Microsoft and is going to be fixed in VC++ 2019u3. For the time being, add a partial template specialisation for the two double-word sized types temporarily as a workaround. This allows the standard library build to get further.
@swift-ci please smoke test |
This is mildly terrifying but looks like the right solution until VC++ fixes it. |
@mikeash - it seems that I have a tendency to come up with somewhat terrifying nuggets of code :-D |
It's an interesting talent to have. Just curious, does the broken implementation fail spectacularly or is it just silently non-atomic or what? |
A bit of both really. So, the thing is that there is a compilation failure, but the true cause of the failure is obscured by the fact that SFINAE hides the fact that the there is a type mismatch on an intrinsic which causes This just works around it by providing the explicit template specialization which being a partial template specialization is given higher precedence and will suffice. The |
Interesting, thanks for explaining and for the fix. |
The checks seem to capture non-MSVC compilers one ARM64 Windows. Does Swift care about e.g. |
@jfbastien yes, Swift cares about |
@jfbastien Only clang (and specifically Swift's branch of clang) can build the runtime. |
OK, maybe I'm confused... This:
Looks like it'll trigger on |
We're building with clang-cl, which still uses Microsoft's STL headers and C++ runtime, AIUI. |
Ah OK, so this is working around an STL header issue, which is why |
Unfortunately,
std::atomic
in msvcprt as of 14.21.27702 is broken fordouble-width atomics on ARM64. This has been reported to Microsoft and
is going to be fixed in VC++ 2019u3. For the time being, add a partial
template specialisation for the two double-word sized types temporarily
as a workaround. This allows the standard library build to get further.
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.