Crash (0xC0000005) when closing application.
Description of problem:
When our customer exits his application it generate an exception 0xc0000005 during the unload of the gnutls library.
The call stack indicates that it is failing in _gnutls_rnd_deinit. while trying to line 140 which looks simple
rnd_initialized = 0;
but it turns out that rnd_initialized is declared as
static _Thread_local unsigned rnd_initialized = 0;
where _Thread_local is defined as __declspec(thread)
and it turns out the Ubuntu 18.04 mingw 7.3 we are using does not support the __declspec(thread)
Is this a known problem? Is it because I am using a too old version of mingw? Which version of mingw are you using when cross compiling to windows?
Call stack at the exception: _fpreset () C++
_gnutls_rnd_deinit() Line 140 C++ _gnutls_global_deinit() Line 415 C++ lib_deinit() Line 530 C++ __do_global_dtors() Line 27 C++ _CRT_INIT() Line 142 C++ __DllMainCRTStartup() Line 211 C++ LdrpCallInitRoutine() Unknown LdrpProcessDetachNode() Unknown LdrpUnloadNode() Unknown LdrpDecrementModuleLoadCountEx () Unknown LdrUnloadDll () Unknown FreeLibrary() Unknown
The fpreset seems to be a red herring when inspection the disassembly. (it is _fpreset+0x190, symbols must be incomplete )
Version of gnutls used:
Distributor of gnutls (e.g., Ubuntu, Fedora, RHEL)
Cross-compiled Compiled and linked by me on Ubuntu 18.04 with mingw version 7.4 for windows.
Difficult but reproducable Steps to Reproduce:
Exception during exit
no exception during exit