Skip to content

findZigLibDirFromSelfExe in infinite loop (Windows) #6640

@BarabasGitHub

Description

@BarabasGitHub

Even invoking zig test empty.zig on an empty file takes forever while consuming 100% of 1 core.
When opening the process with the Visual Studio debugger it shows one main thread with a stack frame that just says [External Code] and the Disassembly view says: No disassembly available.

Zig version: 0.6.0+a31b70c4b
My msvc version according to CmakeOutput.log: Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64

It works fine when I build a 'debug'/non-optimized build, after applying this patch to make it compile (and with the release LLVM libs):

diff --git a/cmake/c_flag_overrides.cmake b/cmake/c_flag_overrides.cmake
index c3225d2c4..e0e92ceb3 100644
--- a/cmake/c_flag_overrides.cmake
+++ b/cmake/c_flag_overrides.cmake
@@ -1,6 +1,6 @@
 if(MSVC)
     set(CMAKE_C_FLAGS_DEBUG_INIT
-        "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
+        "/MT /Zi /Od /Ob0 /D NDEBUG")

     set(CMAKE_C_FLAGS_MINSIZEREL_INIT
         "/MT /O1 /Ob1 /D NDEBUG")
diff --git a/cmake/cxx_flag_overrides.cmake b/cmake/cxx_flag_overrides.cmake
index 2f5473df9..0852ef76d 100644
--- a/cmake/cxx_flag_overrides.cmake
+++ b/cmake/cxx_flag_overrides.cmake
@@ -1,6 +1,6 @@
 if(MSVC)
     set(CMAKE_CXX_FLAGS_DEBUG_INIT
-        "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
+        "/MT /Zi /Od /Ob0 /D NDEBUG")

     set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT
         "/MT /O1 /Ob1 /D NDEBUG")

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavioros-windowsMicrosoft Windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions