https://bugs.winehq.org/show_bug.cgi?id=51596
Bug ID: 51596 Summary: Unhandled exception code c0000005 when running any 64-bit Winelib application Product: Wine Version: 6.14 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: winelib Assignee: wine-bugs@winehq.org Reporter: mail@robbertvanderhelm.nl Distribution: ArchLinux
Somewhere after Wine 6.14, 64-bit Winelib applications are no longer able to start when Wine is compiled with optimizations. Everything still works just fine when setting {C,CXX,CROSSC}FLAGS to "-g -O0", and 32-bit Winelib applications also still work fine. I haven't tested which exact commit introduced this issue, but it at least happens after f63ecaedc72f3580e7016ba71a480025e4d86e99
To reproduce this issue, create a main.cpp file with the following contents and then compile it with `wineg++ -o main main.cpp -mwindows -m64`:
#include <iostream>
int main() { std::cout << "Hello, world!" << std::endl; }
Running main.exe with these versions of the latest master branch version of Wine Staging (wine-6.14-323-g91494ae6f2e right now) prints the following:
0144:err:seh:NtRaiseException Unhandled exception code c0000005 flags 0 addr 0x7bc2dc17
Doing the same thing with a 32-bit Winelib (i.e. with -m32) works just fine, and the 64-bit version also works fine when compiling Wine the following configuration:
CC='ccache gcc' CXX='ccache g++' CROSSCC='ccache x86_64-w64-mingw32-gcc' CFLAGS="-g -O0" CXXFLAGS="-g -O0" CROSSCFLAGS="-g -O0" ../configure --disable-tests --enable-win64
Leaving out those flags brings back the error, so there's likely some kind of UB at play here.