fix windows build errors due to compiler bug#6402
Conversation
|
Line 626 still says Now let me assess the overall change: Summary: This PR moves Analysis:
This is a clean, well-motivated refactoring with no issues. LGTM |
|
This is not a complete fix. I'll push one more commit. |
|
/bigbonk review and roast this pr |
There was a problem hiding this comment.
Two commits, both addressing clang-cl 20 optimizer crashes on Windows:
Commit 1 (container-client pimpl): Moves EgressMapping and EgressState behind a pimpl boundary in container-client.c++. Correctly implemented: forward declarations in the header, full definitions in the .c++ file, destructor defined in the .c++ file, kj::Own<EgressState> initialized with kj::heap<EgressState>(). All access sites updated consistently. The #include <kj/cidr.h> removal from the header is correct since kj::CidrRange is no longer needed there.
Commit 2 (listenOnSockets goto removal): Extracts the socket-type switch into parseSocketType(), a non-coroutine helper returning kj::Maybe<SocketTypeConfig>. This eliminates the goto-over-initialization inside the coroutine that was triggering the clang optimizer crash. The SocketTypeConfig struct fields have the same default values as the old local variables (0, default-constructed reader, nullptr), so behavior is preserved for all three socket types including TCP.
One minor nit posted inline (double-checking the Maybe). No correctness, safety, or compatibility issues.
This review was generated by an AI assistant and may contain errors. Please verify any suggestions independently.
|
Review posted on PR #6402 with approval. Summary of findings:
|
listenOnSockets() uses goto to jump past variable declarations inside a
switch, then co_awaits at the end of the function. This goto-inside-
coroutine pattern creates a pathological CFG that crashes clang-cl 20's
jump-threading and correlated-propagation optimizer passes on Windows
(SIGSEGV / 0xC0000005), breaking the release build intermittently since
at least 2026-03-11.
Extract the switch into a non-coroutine helper Server::parseSocketType()
that returns kj::Maybe. listenOnSockets() calls it and
uses KJ_IF_SOME/continue instead of goto, giving the optimizer a clean
CFG.