On Fri, 3 Oct 2025, LIU Hao wrote:
在 2025-10-2 04:44, Martin Storsjö 写道:
This test, on github actions runners, hit what seems to be an
upstream bug (in the OS or UCRT).
Just skip this test for now. (Don't mark it as XFAIL, as it does
succeed just fine on other configurations.)
Signed-off-by: Martin Storsjö <[email protected]>
---
mingw-w64-libraries/winpthreads/tests/pthread_exit/exit1.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/mingw-w64-libraries/winpthreads/tests/pthread_exit/exit1.c
b/mingw-w64-libraries/winpthreads/tests/pthread_exit/exit1.c
index 5ac729870..a33027327 100644
--- a/mingw-w64-libraries/winpthreads/tests/pthread_exit/exit1.c
+++ b/mingw-w64-libraries/winpthreads/tests/pthread_exit/exit1.c
@@ -41,6 +41,13 @@
int
main(int argc, char * argv[])
{
+#if defined(_M_ARM) || defined(_M_ARM64)
+ /* This test fails on AArch64 (ARM untested) on modern versions of
+ * Windows, possibly on modern HW.
+ * See
https://developercommunity.visualstudio.com/t/Crash-when-doing-ExitThread-on-main-thre/10975751
+ * for upstream bug report. */
+ return 77;
+#endif
/* A simple test first. */
pthread_exit((void *) NULL);
I think we had better disable this test. Calling `ExitThread()` from main is
not something that one should do, since the system or some third-party
software, libraries etc. can also create threads before the main function.
That's totally reasonable to me as well.
The docs for pthread_exit does make it sound like this would be ok to do
though:
After the last thread in a process terminates, the process terminates
as by calling exit(3) with an exit status of zero; thus, process-shared
resources are released and functions registered using atexit(3) are
called.
Similarly, the docs for ExitThread says:
If the thread is the last thread in the process when this function is
called, the thread's process is also terminated.
Neither of these explicitly say that it's ok to exit the main thread like
this, but that is kinda implied. Either the main thread is the last to be
exied, and the process exits then, or another thread keeps running, and
the process is exited when that exits.
Separately, in practice, winpthreads actually uses _endthreadex, not
ExitThread.
First when investigating this issue, I wondered if ExitThread would work
better than _endthreadex, but there was no difference. The docs for
_endthreadex say "_endthreadex terminates a thread that's created by
_beginthreadex.", but main() really isn't such a thread - even though it
probably has had the CRT initialized to the same extent as _beginthreadex
does.
So all in all, I don't mind disabling the test - it's a kinda iffy thing
to do in any case.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public