Hi everyone, inspired by a posting here and because longjmp always crashed for me I investigated a bit and it seems the following is true:
If the second argument to setjmp is NULL longjmp will simply restore the register state and flags and resume program execution. In fact this fixes all crashes for me, so I guess the second argument should always be NULL for C programs. If the second argument to setjmp is not NULL longjmp will create and populate what looks like a EXCEPTION_RECORD structure on the stack, with ExceptionCode set to 0x80000026/STATUS_LONGJUMP. This IMO strongly suggests that the second argument to setjmp should be a pointer to a CONTEXT structure. see: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680605%28v=vs.85%29.aspx Running on Windows 10 Pro, gcc version 5.2.0 (x86_64-win32-sjlj-rev0, Built by MinGW-W64 project) Regards, Thomas ------------------------------------------------------------------------------ _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
