-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segfault doing ./gap -A -c 'FORCE_QUIT_GAP(TestPackage("aclib"));'
#4820
Comments
Simplifying, the same kind of issue arises with The bug is also caused by: |
This has been a bug ever since the |
I'm trying to trace this bug down. In general the problem is we are longjmping to a no-longer valid buffer. I'm going to brain-dump a bit below. The pattern is the following: QuitGap throws, which returns to some part of parsing, using TRY_IF_NO_ERROR. TRY_IF_NO_ERROR doesn't save the old value of ReadJmpError, so it is now invalid, until set again. We carry on reading (as we don't return immediately). As we are reading from an InputTextStream, we call a GAP function to get more input from our InputTextStream (to check if it ends double-colon). This calls EvalOrExecCall, which then checks UserHasQuit, which calls GAP_THROW. However, since the last GAP_THROW we haven't updated the jump buffer. So in short the problem is:
So, some fix choices are (and I'm curious what @fingolfin thinks, as I think these might involve retangling previously untangled things).
We could also do these things above if we have NrError > 0. |
Further thoughts, I think GAP normally assumes once a GAP_THROW has been performed, we won't evaluate any more GAP functions until the end of the current statement, but of course that's not true if we are reading from an InputTextString and we need more input. This isn't just a "quitting" problem, for example |
This "works" for any package, so this is a bug in GAP, not the fault of
aclib
, which just happened to be the example I last tried this with.The text was updated successfully, but these errors were encountered: