https://bugs.winehq.org/show_bug.cgi?id=49138
Bug ID: 49138 Summary: winegcc: argc and argv arguments of main() get corrupted Product: Wine Version: 5.7 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: tools Assignee: wine-bugs@winehq.org Reporter: mail@robbertvanderhelm.nl Distribution: ---
I first came across this issue with winelib compilation in Wine 5.7 while I was working on yabridge, a Wine VST bridge. The issue still persists on the latest commit in the Wine repository as I'm writing this (commit bf1abba, with the release of Wine 5.8). I'm not exactly sure what is going on, but the issue can be reproduced as follows:
#include <iostream>
int main(int argc, char* argv[]) { std::cout << "argc = " << argc << std::endl; std::cout << "argv[0] = " << argv[0] << std::endl; }
If you compile the above (or the C-equivalent) with `wineg++ test.cpp -o test` and run test.exe, then at least on my system it will always print 70624 as the value of argc and some uninitialized looking data for argv[0]. This happens regardless of whether the program receives any command line arguments or not.
Winelib applications compiled with the toolchain that comes with Wine 5.6 can be run without problems under Wine 5.7 or 5.8. The winelib compilation issue with Wine 5.7+ exists on Ubuntu 18.04, Ubuntu 20.04, Arch Linux and Manjaro, both when using the distro provided packages and when building Wine from source.