You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turns out this is an issue with -s (remove stack overflow checks) specifically. MichalN says:
Seems the difference is that the code calls __TNK instead of __TNC in function prolog, but why that makes a difference I don't yet understand. The crashes are super weird because it's trap 1 i.e. debug breakpoint, but it seems to be the OS somehow generating that.
OK, now I understand at least most of it. The __TNC ("thunk and check" I guess) function checks the stack and grows it if necessary, then performs any necessary thunking for 16-bit code. The __TNK ("thunk") function only does the thunking. Which means it does not grow the stack.
I'm not sure if this is a defect in the runtime (__TNK function should grow the stack as well) or in the code generator plus runtime (there should be a separate thunk + grow function for this).
FYI, the thunking prolog is necessitated by calling 16-bit APIs and passing addresses of items on the stack to them. The data on the stack needs to be aligned so as to not cross 64K boundaries.
But at the same time the thread stack is not committed, uses the guard page mechanism, and needs to be grown page by page.
Solution -- don't use the -ox switch, use the individual -o? options instead. And don't use -s either.
And indeed it seems to build and run ok with -obmiler
The text was updated successfully, but these errors were encountered:
Fixes#55 - turns out optimisation isn't broken in general (open watcom has some optimisations on by default), just the -s option (remove stack overflow checks) is problematic. Thanks to MichalN for figuring this out!
If you build for OS/2 using OpenWatcom 1.9 with optimizations turned on (-ox), C-Kermit crashes on startup with:
The point at which it crashes is ckomou.c:362
Turns out this is an issue with -s (remove stack overflow checks) specifically. MichalN says:
And indeed it seems to build and run ok with -obmiler
The text was updated successfully, but these errors were encountered: