RT-CRT-TIMED-WAIT-MSVC1439: fix crt_timed_wait.cpp compilation on MSVC 19.39 #2677
Closed
github-bot
wants to merge 1 commit from
github-bot/gh-2677 into main
AGit
pull from: github-bot/gh-2677
merge into: github:main
github:main
github:perf/darner-title-priority-ceiling
github:gh-readonly-queue/main/pr-3311-b5c45b663dbc5a9c3532bb3f307e5f81b32faefa
github:gh-readonly-queue/main/pr-3088-af22e7847ff5808f72d1a1881c24be2fafd20b54
github:gh-readonly-queue/main/pr-3123-7f3fa026a94c6646e89244f28e1ce22290361867
github:gh-readonly-queue/main/pr-3354-637baa0b77ba47222e7280b17c1a59c6a1781d57
github:gh-readonly-queue/main/pr-3365-d7a0e0196a43834813014b4bd3aa5502a8263b14
github:gh-readonly-queue/main/pr-3361-5dfe8bbd05ed12fb2f2e1718d9af77a7c5f46fd8
github:gh-readonly-queue/main/pr-3366-8da9148204e9d12c585efa9ac2b7cc1ab08c7682
github:fix/runtime-test-conservative-fixtures
github:ci/shard-semantic-linux
github:docs/fg-limit-fps-switch
github:fix/runtime-test-fixture-paths
github:fix/runtime-test-fixture-readers
github:fix/read-file-hard-link
github:fix/book-slot-heap-never-read
github:fix/depth-resolve-spv-path
github:fix/indirect-unused-batched
github:gh-pr/3358/base
github:fix/xmem-refusal-diagnostics
github:gh-pr/3357/base
github:ci/shorten-ci-time
github:fix/alias-later-queued-submissions
github:claude/gallant-sagan-aamatr
github:gh-pr/3342/base
github:gh-pr/3341/base
github:d3d12/agility-sdk-621
github:gh-pr/3293/base
github:gh-pr/3319/base
github:gh-pr/3318/base
github:gh-pr/3315/base
github:gh-pr/3313/base
github:gh-pr/3314/base
github:claude/fervent-curie-m19lnr
github:gh-pr/3216/base
github:gh-pr/3272/base
github:gh-pr/3276/base
github:gh-pr/3279/base
github:gh-pr/3257/base
github:gh-pr/3258/base
github:gh-pr/3271/base
github:codex/skip-no-hit-ray-passes
github:gh-pr/3230/base
github:gh-pr/3266/base
github:gh-pr/3247/base
github:gh-pr/3246/base
github:gh-pr/3244/base
github:claude/sharp-sagan-1jqnp3
github:t3/preserve-fsr-sdk-restart-path
github:t3/propagate-host-failure-hresult
github:t3/launcher-custom-parameters
github:t3/series-x-2160-startup
github:codex/d3d12-uncapped-simulation
github:ci/less-to-run
github:perf/native-compute-shader-forms
github:claude/blissful-franklin-ukp7ag
github:codex/full-precompile-default
github:gh-pr/3166/base
github:gh-pr/3148/base
github:gh-pr/3138/base
github:gh-pr/3106/base
github:gh-pr/3057/base
github:gh-pr/2756/base
github:gh-pr/2812/base
github:gh-pr/3032/base
github:gh-pr/2992/base
github:notes/card-time-and-plant-flicker
github:gh-pr/2986/base
github:gh-pr/3000/base
github:gh-pr/2966/base
github:gh-pr/2924/base
github:gh-pr/726/base
github:gh-pr/2761/base
github:gh-pr/2663/base
github:gh-pr/2861/base
github:gh-pr/2862/base
github:gh-pr/2820/base
github:gh-pr/2811/base
github:gh-pr/2803/base
github:rt-call-trace
github:gh-pr/2802/base
github:gh-pr/2766/base
github:perf/ahead-split
github:gh-pr/2589/base
github:gh-pr/2699/base
github:gh-pr/2696/base
github:docs/readme-runtime-proposal
github:gh-pr/1346/base
github:codex/coord-claim-check-20261124-7e48
No reviewers
Labels
Clear labels
accessibility
Barrier affecting people with disabilities
area: ci
.github/ workflows and settings
area: d3d12
The D3D12 runtime in d3d12/ (Rust: leonida.exe and its crates)
area: docs
Documentation
area: launcher
The launcher (launcher/)
area: runtime (legacy)
The earlier Vulkan runtime in runtime/
area: shader translator
The shader translator (leonida-shader, tools/rdna2spirv) and its tests
area: tools
tools/ and scripts/
area: viewer
The map viewer (viewer/)
bug
Something isn't working
dependencies
Pull requests that update a dependency file
documentation
Improvements or additions to documentation
duplicate
This issue or pull request already exists
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
missing claim
Needs a claim in #14
needs in-game run
Changes the code a frame runs through: needs the 300 s in-game gate (docs/game_gate.md)
needs rebase
Conflicts with the base branch: rebase it on main
needs-triage
Needs maintainer evaluation before the next triage state
question
Further information is requested
ready-for-agent
Fully specified and ready for an AFK agent
submodules
Pull requests that update submodules code
wontfix
This will not be worked on
No labels
accessibility
area: ci
area: d3d12
area: docs
area: launcher
area: runtime (legacy)
area: shader translator
area: tools
area: viewer
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
missing claim
needs in-game run
needs rebase
needs-triage
question
ready-for-agent
submodules
wontfix
Milestone
Clear milestone
No items
No milestone
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set
Reference
github/ubiquitarianism--leonida!2677
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2677"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@bobcatchris on GitHub · 2026-11-30 01:45 UTC · original
bobcatchris:fix/crt-timed-wait-msvc1439→main· +13 −3 · 2 files · 1 commits · closed without mergingClaimed in #2570 as
RT-CRT-TIMED-WAIT-MSVC1439.What and why
On MSVC 19.39 (Visual Studio 2022 17.9 / toolset 14.39),
runtime/src/crt_timed_wait.cppfails to compile due to a mismatch with the MSVC 14.39_Cnd_timedwaitdeclaration. This change matches the MSVC 14.39_Cnd_timedwaitdeclaration inruntime/src/crt_timed_wait.cppand adds regression coverage inruntime/test/crt_timed_wait_test.cppwithout affecting newer MSVC toolsets or Linux/MinGW builds.Verification
Hardware / OS: native Windows 11 Pro (
10.0.26200), MSVC19.39.33519, CMake + Ninja.main(40e7fe69d).19.39.33519build compilescrt_timed_wait.cppand passescrt_timed_wait_test(Red -> Green).python -I scripts/check_no_game_data.py runtime/src/crt_timed_wait.cpp runtime/test/crt_timed_wait_test.cpp— PASS.AI-assisted: Antigravity (Gemini 4 Neon)
@fiestorra on GitHub · 2026-11-30 04:37 UTC · original
Independent verification on this machine (Windows 11, MSVC 19.44.35226, the 14.4x headers), and the interesting part is why the negative control does not bite here.
1. It applies.
merge-treeclean;df213d828cherry-picks ontomain1d22590b9without a conflict. It changes one declaration inruntime/src/crt_timed_wait.cppand adds two#ifguards to the test:2. It builds and passes, three times:
3. The negative control does not distinguish the two versions, and that is the useful finding. With the source reverted to
main's declaration and the PR's test kept:Why: this is a declaration fix -
_Thrd_resultinstead ofint,_CRTIMP2_PUREinstead of__declspec(dllimport)- not a behaviour fix. With this toolchain both declarations compile and the test cannot tell them apart. The machine that distinguishes them is one whose<xthread>declares_Cnd_timedwaitas_CRTIMP2_PURE _Thrd_result(14.39) rather than not declaring it at all (14.4x); mine is 19.44.35226, so it compiles either way.So what is verified: it applies, it builds here, it runs PASS, and it does not regress. What is not: that the new declaration is the one 14.39 needs - that needs a 14.39 toolchain, which is a CI matrix question, not something this machine can answer. The PR's own comment ("still declares it with
_CRTIMP2_PURE _Thrd_result") is the claim to check there.The comparison with the other two I verified tonight is the point: #2678's negative control failed the old code (
test_windows_venv_worker), #2679's could not run (QEMU absent), and #2677's runs but cannot tell the two apart (declaration-only, toolchain-gated). Three PRs, three different kinds of "green", and only the reviewer who knows which one they are looking at can act on them.Written with an AI assistant.
df213d8289to3ba6122cfe@merzleckeier on GitHub · 2026-11-30 17:09 UTC · original
Independent red/green with the exact MSVC 19.39.33519 toolset
MEASURED. I tested
3ba6122cfmerged ontomain7663c34fc(treedae9cfaae). I used Microsoft's x64cl.exeandlink.exe, STL headers and libraries from the Visual Studio Build Tools 2022 17.9.0 release, plus Windows SDK 10.0.26100.cl /Bvreported19.39.33519.0for the compiler. Both the compiler and test executable ran under Wine 11.22 on CachyOS.main'scrt_timed_wait.cppwith/MD /std:c++20C2556andC2371at_Cnd_timedwait:intconflicts with_Thrd_resultinxthreads.h:127.main's test source insteadLastErrorcheck after an unnotified timeout failing.The executable imports
_Cnd_timedwaitfromMSVCP140.dll, and the runtime trace shows Wine's builtin DLL was loaded. The 14.39condition_variableheader calls that import directly. The last-error control therefore exercises the old header's route. Scope: two translation units and the synthetic test on Wine. AI-assisted: Codex (GPT-6.2 Sol).@KelboLive on GitHub · 2026-12-01 14:58 UTC · original · reviewed
The declaration now matches 14.39 exactly (
vs-2022-17.9 stl/inc/xthreads.h:127), and the base file really does failC2556/C2371against that declaration, so the fix itself is right. I could not install 14.39/14.40 here, so I checked against themicrosoft/STLtags and emulated the header line with the installed 14.44 toolset;crt_timed_wait_testpasses all 19 checks at 14.44, and the merged tree is clean.Two things need changing:
_Cnd_timedwait(vs-2022-17.10 xthreads.h:126) and itscondition_variable:242still calls it; only 14.41 (17.11) moves to_Cnd_timedwait_for, which is the symbol this file defines. That matters because the new gate is_MSC_VER >= 1940: on 14.40 thelast_error == ERROR_INVALID_DATAcheck atcrt_timed_wait_test.cpp:183runs while the shim is bypassed, and a timed-out call leavesERROR_TIMEOUT(I measuredres=0, LastError=1460), so the test fails on the very toolset the boundary is supposed to cover. Use>= 1941(and< 1941for the skip), and fix the comment the same way.A cleaner shape that fixes both: guard the prototype itself with
#if _MSC_VER >= 1941, so 14.38–14.40 use the header's own declaration (which also removes theC2382the current form hits on 14.38, whose header declares it withoutnoexcept), and leave the tests unguarded.Minor, not a defect:
_CRTIMP2_PUREexpands to nothing in a user TU, so this also drops the explicit__declspec(dllimport);dumpbinconfirms the import still comes fromMSVCP140.dll, so behaviour is unchanged — worth a line in the comment so nobody "restores" the dllimport later.@KelboLive on GitHub · 2026-12-01 14:59 UTC · original
Correction to my review above — point 1 is wrong, and the other review on this PR has it right. I checked the two tags directly:
So 14.40's
<mutex>calls_Cnd_timedwait, which is the symbol this file defines — the shim is in the path there, and thelast_error == ERROR_INVALID_DATAcheck would pass. The_MSC_VER >= 1940guard is therefore conservative on 14.40, not failing; my "shim is bypassed on 14.40" claim and the 1460 measurement were an artifact of calling the symbol directly against the DLL rather than through<mutex>.What remains true: 14.41 and 14.42 call
_Cnd_timedwait_for/_Cnd_timedwait_for_unchecked, both defined in this file (:63,:58), so the guard also skips checks that would pass there. If the intent is to keep them wherever the shim is in the path,>= 1942(or no guard at all) would preserve coverage;>= 1940is safe but loses it from 14.40 on.The fix to the declaration itself is unaffected: 14.39/14.40 declare
_CRTIMP2_PURE _Thrd_result, main'sintredeclaration is C2556/C2371, and this PR compiles clean.@merzleckeier on GitHub · 2026-12-01 15:09 UTC · original
I tested the released 14.38 and 14.40 toolsets from the Microsoft 17.10 servicing catalog, with
3ba6122cmerged intoedf7d01f8, Windows SDK 10.0.26100 and Wine 11.22. This tests the same unmodified std::condition_variable path as crt_timed_wait_test.The 14.39 compile fix still has the earlier red/green evidence. For the LastError test, the 14.40 result suggests guarding the assertion by the actual wait_for route, or checking preservation explicitly through the shim path. This is measured under Wine, including with Microsoft’s CRT. It would be useful to compare the same 14.40 executable on native Windows. Synthetic tests only. AI-assisted (Codex).
@merzleckeier on GitHub · 2026-12-01 15:20 UTC · original
Native Windows 19.40 follow-up to the Wine run: I used a GitHub-hosted Windows runner (build 26100), Microsoft cl.exe 19.40.33821.0 and the app-local Microsoft msvcp140.dll 14.40.33816.0. This was the stock test and implementation at
3ba6122cmerged into88a9f133e.Main still fails the compile at C2556/C2371 and the PR compiles and links. The native executable exits 1 in all three trials. The expanded trial logs show both LastError assertions failing: preservation of the pre-existing ERROR_TIMEOUT, and preservation of the caller’s ERROR_INVALID_DATA after a timed-out wait_for. The corresponding timing assertions pass. This reproduces the LastError problem on Windows itself.
Native build and test logs · MEASURED with the unmodified synthetic test. AI-assisted (Codex).
@aslan2142 on GitHub · 2026-12-01 16:46 UTC · original
Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (
d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools,d3d12/, or general docs), please feel free to reopen it.Pull request closed