Variable startinfo is used only by __(w)getmainargs() call passed by the
pointer in pre_cpp_init() function. The __(w)getmainargs() function does
not use or store the pointer value, so the variable does not have to be
static. Declare this variable just on the pre_cpp_init() function stack.
---
 mingw-w64-crt/crt/crtexe.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c
index 2c6fbd7e7062..319cace6f50a 100644
--- a/mingw-w64-crt/crt/crtexe.c
+++ b/mingw-w64-crt/crt/crtexe.c
@@ -62,7 +62,6 @@ static int argret;
 static int mainret=0;
 static int managedapp;
 static int has_cctor = 0;
-static _startupinfo startinfo;
 extern LPTOP_LEVEL_EXCEPTION_FILTER __mingw_oldexcpt_handler;
 
 extern void _pei386_runtime_relocator (void);
@@ -125,6 +124,8 @@ pre_c_init (void)
 static void __cdecl
 pre_cpp_init (void)
 {
+  _startupinfo startinfo;
+
   startinfo.newmode = _newmode;
 
 #ifdef _UNICODE
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to