crt: tests: update t_tls

Previously, this test would simply print an error message if `tls_value` had
an unexpected value. Instead, exit with non-zero to signal an error.

When compiled with clang++, it was producing the following diagnostic:

mingw-w64/mingw-w64-crt/testcases/t_tls_cpp.cpp:29:20: warning: variable length arrays in C++ are a Clang extension [-Wvla-cxx-extension]
   29 |     HANDLE threads[processors];
      |                    ^~~~~~~~~~
mingw-w64/mingw-w64-crt/testcases/t_tls_cpp.cpp:29:20: note: initializer of 'processors' is not a constant expression
mingw-w64/mingw-w64-crt/testcases/t_tls_cpp.cpp:26:20: note: declared here
   26 |     const unsigned processors = si.dwNumberOfProcessors;
      |                    ^
1 warning generated.

To avoid this warning, use C++ new/delete operators instead of VLA.

Add t_tls to testcases/Makefile.am.

Signed-off-by: Kirill Makurin <maiddaisuki@outlook.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/testcases/Makefile.am b/mingw-w64-crt/testcases/Makefile.am
index 6bf961b..232e599 100644
--- a/mingw-w64-crt/testcases/Makefile.am
+++ b/mingw-w64-crt/testcases/Makefile.am
@@ -110,6 +110,7 @@
 if !ARM64EC
 testcase_progs += \
   t_iostream \
+  t_tls \
   t_wrongret
 endif
 
@@ -120,6 +121,7 @@
 t_isfine_SOURCES = t_isfine.cpp
 t_main_cpp_SOURCES = t_main_cpp.cpp
 t_staticconstmember_SOURCES = t_staticconstmember.cpp
+t_tls_SOURCES = t_tls.cpp
 t_trycatch_SOURCES = t_trycatch.cpp
 t_wrongret_SOURCES = t_wrongret.cpp
 
@@ -129,6 +131,7 @@
 t_isfine_LDFLAGS = $(AM_LDFLAGS)
 t_main_cpp_LDFLAGS = $(AM_LDFLAGS)
 t_staticconstmember_LDFLAGS = $(AM_LDFLAGS)
+t_tls_LDFLAGS = $(AM_LDFLAGS)
 t_trycatch_LDFLAGS = $(AM_LDFLAGS)
 t_wrongret_LDFLAGS = $(AM_LDFLAGS)
 
@@ -137,6 +140,7 @@
 t_isfine_LDFLAGS += -static
 t_main_cpp_LDFLAGS += -static
 t_staticconstmember_LDFLAGS += -static
+t_tls_LDFLAGS += -static
 t_trycatch_LDFLAGS += -static
 t_wrongret_LDFLAGS += -static
 endif
diff --git a/mingw-w64-crt/testcases/t_tls.cpp b/mingw-w64-crt/testcases/t_tls.cpp
index 2425819..40e3403 100644
--- a/mingw-w64-crt/testcases/t_tls.cpp
+++ b/mingw-w64-crt/testcases/t_tls.cpp
@@ -26,7 +26,8 @@
     const unsigned processors = si.dwNumberOfProcessors;
 
     // Make a thread for every processor and assign the thread to it
-    HANDLE threads[processors];
+    HANDLE *threads = new HANDLE[processors];
+
     for (unsigned i = 0; i < processors; i++) {
         threads[i] = (HANDLE)_beginthreadex(0, 0, thread_fn, 0, CREATE_SUSPENDED, 0);
         SetThreadAffinityMask(threads[i], 1 << i);
@@ -41,7 +42,12 @@
     for (unsigned i = 0; i < processors; i++)
         CloseHandle(threads[i]);
 
-    std::cout << "How is it possible that tls_value is " << tls_value << " != 0 ?" << std::endl;
+    delete[] threads;
+
+    if (tls_value != 0) {
+        std::cout << "How is it possible that tls_value is " << tls_value << " != 0 ?" << std::endl;
+        std::terminate ();
+    }
 
     return 0;
 }