Skip to content
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

mergeValue.mergeField: incompatible values #667

Closed
brianhuffman opened this issue Dec 6, 2019 · 0 comments
Closed

mergeValue.mergeField: incompatible values #667

brianhuffman opened this issue Dec 6, 2019 · 0 comments
Assignees
Labels
bug Something not working correctly

Comments

@brianhuffman
Copy link
Contributor

We get a panic from the symbolic backend when we try to :prove a predicate involving a symbolic if-then-else on two records with the same fields written in different orders:

Cryptol> :prove \x -> (if x then { a = True, b = False } else { b = False, a = True }).a
cryptol: You have encountered a bug in Cryptol's implementation.
*** Please create an issue at https://github.com/GaloisInc/cryptol/issues

%< ---------------------------------------------------
  Revision:  ce0365fb80e66bf0aa844b0dac86d6d1777809fb
  Branch:    master (uncommited files present)
  Location:  Cryptol.Symbolic.Value
  Message:   mergeValue.mergeField: incompatible values
CallStack (from HasCallStack):
  panic, called at src/Cryptol/Utils/Panic.hs:21:9 in cryptol-2.8.1-inplace:Cryptol.Utils.Panic
  panic, called at src/Cryptol/Symbolic/Value.hs:148:9 in cryptol-2.8.1-inplace:Cryptol.Symbolic.Value
%< ---------------------------------------------------

The code for mergeValue was assuming that we normalize the field order of all record expressions alphabetically, but it turns out that we don't do that.

Probably the right way to fix problems like this once and for all is to use a Map instead of a list of pairs in the VRecord constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something not working correctly
Projects
None yet
Development

No branches or pull requests

1 participant