-
Notifications
You must be signed in to change notification settings - Fork 53
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
Homebrew TC algorithm breaks evar map invariants #578
Comments
@FissoreD this seems a bug in the hook compiling instances. The code changed a lot, it would be nice if we could give it a try (this is on coq-master, not master... so we need to do some git gimmics). |
It's easy to backport the change that makes nf_evar explode on dangling evars, if that helps you. |
This particular bug seems to have been fixed on coq-elpi master (by #581 most likely). The test-suite still fails with an anomaly on undefined evars though. I'll try to minimize the bug again. |
Thanks! |
I am very confused now: the same reduced example still triggers an anomaly when it is compiled from within the test folder of tc-elpi, but not when launched from the toplevel loading the coq-elpi files installed in the user-contrib repo. Those files are the same as the ones from my CI folder where coq-elpi is compiled, but somehow the loadpath seems to be an important difference. |
While cleaning up the evar normalization algorithms, I realized that the coq-elpi TC solver messes with some invariants of the evarmap.
To reproduce the bug, one needs a patch that makes
Evarutil.nf_evar
throw an anomaly on missing evars and that can be found at coq/coq#18554. Note that the current function on master is more lenient as it ignores such situations, but this is still very much unsound (the evarmap is really, really needed to make sense of evar instances represented as sparse lists, so it's just producing garbage in this case).Here is a reproducible snippet extracted from one of the tests:
Here is a backtrace:
As you can see, this happens when normalizing an evarmap, so this means that it's already too late, some info from the evarmap contains dangling evars in its body. This can probably be traced by instrumenting evar instantiation to detect this situation but it's a fairly intrusive change, and in any case this reflects a bug in coq-elpi so I don't really feel qualified to track it down.
The text was updated successfully, but these errors were encountered: