crt: test: Add t_sigfpe test cases for floating point SIGFPE triggers
Add test cases for different ways how the SIGFPE can be triggered. Include
explicit raise and both x87 and SSE instructions of different scenarios.
The test file is written to be compiled for both Linux and MinGW-w64
systems. Catch floating point exceptions by SIGFPE signal handler.
Long jumping from the signal handler has to be done via the siglongjmp()
function. mingw-w64 does not provide it yet, so include simple
implementation into the test itself.
Run test cases from both primary thread and also from new threads created
by CRT functions _beginthreadex and _beginthread and also by winpthreads.
MS documentation says that threads spawned by CRT functions _beginthreadex
and _beginthread properly calls registered signal handlers as opposite of
WinAPI function CreateThread (threads spawned by WinAPI CreateThread
ignores registered signal handlers and directly throws SEH exceptions).
Also check second argument of SIGFPE handler. Both msvcrt and UCRT pass
also second argument to SIGFPE handler which provides the type of the
exception.
More of those subcases are skipped because they cause crashing of the whole
process. These subcases would be unskipped by followup changes which fix
the mingw-w64-crt code.
Signed-off-by: LIU Hao <lh_mouse@126.com>
2 files changed