From 0f4a32fccce9106eb00876678fd58a95df62fb5b Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Tue, 6 May 2025 00:29:52 +0000 Subject: Fix the intermittent failures of tests/autodiff/auto-differential-type (#7006) The use of `_wfopen_s()` was incorrect in a way the the result value had to be checked. However, even with a proper handling of the failed case, the repro-rate was same. The issue was reproduced at 5%~20% rate with the following commands, build/Release/bin/slang-test.exe tests/autodiff/auto-differential-type -api dx11 -use-test-server -server-count 8 Co-authored-by: Yong He --- source/core/slang-stream.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/core/slang-stream.cpp') diff --git a/source/core/slang-stream.cpp b/source/core/slang-stream.cpp index 07c7e858c..a6ddfe1e9 100644 --- a/source/core/slang-stream.cpp +++ b/source/core/slang-stream.cpp @@ -162,10 +162,15 @@ SlangResult FileStream::_init( SLANG_ASSERT(!"Invalid file share mode."); return SLANG_FAIL; } + if (share == FileShare::None) - _wfopen_s(&m_handle, fileName.toWString(), wideMode); + { + m_handle = _wfsopen(fileName.toWString(), wideMode, _SH_DENYNO); + } else + { m_handle = _wfsopen(fileName.toWString(), wideMode, shFlag); + } #else m_handle = fopen(fileName.getBuffer(), mode); #endif -- cgit v1.2.3