Repository navigation
Conversation
Current MSVC (reproduced with cl 19.50) still miscompiles [[msvc::no_unique_address]]: constructing a let_value sender whose function captures a value alongside a nested sender writes past the end of a stack temporary (ASan stack-buffer-overflow, C4789 under /sdl) and corrupts the captured values. Disable the attribute for all MSVC versions instead of only for _MSC_VER < 1943. Add a regression test for the let_value case, and drop the MSVC-only expectation in the fork_join test: the missing move it worked around came from the same miscompile, and MSVC now matches other compilers. Fixes NVIDIA#2099
This branch has not been deployed
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.
Fixes #2099.
MSVC still miscompiles
[[msvc::no_unique_address]]. With cl 19.50 (the toolset in the 14.50 Windows CI job), the code from the issue writes past the end of a stack temporary while constructing thelet_valuesender at__let.hpp:519. Under/fsanitize=addressthat's a stack-buffer-overflow. Without ASan the program runs, but the lambda's captures come back corrupted. The C4789 in the issue is the compiler warning about the same write, which-sdlturns into an error.turned the attribute off for MSVC once before for incorrect codegen (4ccd753). It came back for
_MSC_VER >= 1943, which covers both MSVC versions in CI. This diff turns it off for all MSVC versions again. clang-cl is unchanged.It also adds a regression test to
test_let_value.cppthat checks the captured values aftersync_wait, so it fails with or without ASan. And it removes the MSVC-only expectation in the fork_join test. As #2302 (comment) found, that move was missing only because of this attribute. With it off, MSVC does the move like the other compilers.Tested with MSVC 19.50 and the flags from
test-windows.ps1(/fsanitize=address /EHsc). The new test fails on main in Debug and Release. With this change, all 1106 tests pass in both.The cost is that types with empty
no_unique_addressmembers get bigger on MSVC, same as after the 2023 change.ASan output on main