Fix co_composed crash on MSVC#1724
Open
annihilatorq wants to merge 1 commit intochriskohlhoff:masterfrom
Open
Conversation
Author
|
... or perhaps if this is considered a bug in the compiler's codegen, then asio will not take any action, and it would be better to report this to the MSVC as their bug? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When built with the Visual Studio generator in
Release(/O2), MSVC may emit an aligned SSE store (movaps) forco_composedblock storage that is only 8-byte aligned. At runtime this results withSTATUS_ACCESS_VIOLATION; in the failing case the fault appears to come from a misalignedmovapsstore triggering a GP faultI am reproducing this with
blazeauth/aeroat0d125b94dbd3b35d4b8a4b67483e109a77794c3eReleaseconfigexamples/chilkat.exe(the same issue also reproduces with other examples)asiofrom 1.32 (not tested below) to 1.38I don't see a problem with
/O1, so far, it only appears on/O2when using
clang-clwith the same configuration as above, there are no errorsThis looks like an MSVC backend/codegen bug rather than an
asiologic bug, because generated code usesmovapseven though the destination address is only 8-byte aligned in the failing caseThe fix is to force the
blockstorage used here to be at least 16-byte aligned on MSVC, which avoids the bad codegen assumption and makes the generated aligned SSE access safe:P.S.

screenshot of the failing
movapsstore: