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

Possible bugs involving CCBV.{set, diff, union} #370

Closed
favonia opened this issue May 17, 2021 · 1 comment
Closed

Possible bugs involving CCBV.{set, diff, union} #370

favonia opened this issue May 17, 2021 · 1 comment

Comments

@favonia
Copy link
Contributor

favonia commented May 17, 2021

The program

let () =
  let v1 = CCBV.empty () in
  let () = CCBV.set v1 64 in
  let v2 = CCBV.diff (CCBV.empty ()) (CCBV.empty ()) in
  let v3 = CCBV.union v1 v2 in
  Format.printf "union (%a, %a)@.==>@.%a@." CCBV.pp v1 CCBV.pp v2 CCBV.pp v3

on at least one computer would output

union (bv {00000000000000000000000000000000000000000000000000000000000000001}, bv {})
==>
bv {00000000000000000000000000000000000000000000000000000000000000011}

Notice the two 1s at the end of the result of the union. There should only be one 1.

The bug was discovered in a relatively complicated program, and in the original context 64 can be replaced by a much smaller number (e.g., 5). However, 64 is the smallest number for the above standalone program to demonstrate the bug on my machine. By the way, I was using v3.4 but none of the later commits seemed to touch the CCBV module, and thus I believe the bug is still in the master branch.

@c-cube
Copy link
Owner

c-cube commented May 17, 2021

Thank you for the report, that was tricky indeed. It should be fixed now.

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

No branches or pull requests

2 participants