Skip to content

Conversation

@theuni
Copy link
Contributor

@theuni theuni commented Sep 28, 2021

CFLAGS is unused, so the tests have likely been running without these flags set.

CFLAGS is unused, so the tests have likely been running without these flags
set.
@theuni
Copy link
Contributor Author

theuni commented Sep 28, 2021

This uncovered some potential UB in a test:

$ ./test-verify

Running libminisketch tests in verify mode with complexity=4
src/test.cpp:118:45: runtime error: shift exponent 64 is too large for 64-bit type 'long unsigned int'
#0 0x562072e2453c in (anonymous namespace)::TestExhaustive(unsigned int, unsigned long) (/home/cory/dev/minisketch/test-verify+0x6a153c)
#1 0x562072e26df9 in main (/home/cory/dev/minisketch/test-verify+0x6a3df9)
#2 0x7f5a8c7070b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#3 0x562072e235ad in _start (/home/cory/dev/minisketch/test-verify+0x6a05ad)

@sipa sipa mentioned this pull request Sep 29, 2021
@sipa
Copy link
Collaborator

sipa commented Sep 29, 2021

See #51.

sipa added a commit that referenced this pull request Oct 1, 2021
294b6c5 Use correct flags variable for c-i (Cory Fields)
8d52856 Fix exhaustive test check (Pieter Wuille)

Pull request description:

  There were 3 issues:

  1. The comparison between `counts[...]` and `Combination()` wasn't running at all (`(i >> bits)` is always 0 for i==0, so the loop would instantly exit).
  2. The `counts` values were wrong (because it was counting a sum across all implementation), so if they would be compared to something, the test would incorrectly fail.
  3. `(i >> bits)` is undefined when bits==64.

  (1) would be fixed by changing `i >> bits` to `(i >> bits) == 0`, but that leaves issue (3), so introduce a `mask` and use a different way of writing the same, that keeps working for bits==64. (2) is fixed by only incrementing counts[...] for impl==0.

  This was discovered through #50.

ACKs for top commit:
  naumenkogs:
    ACK 294b6c5

Tree-SHA512: 770af770898fb82abf390b7cd21f6ac8657d16dbf391c1d5825c62a3c17c8d50a36481f91254020bd00bfdda493507406df2110292fe8edc396db28181ca94b5
@sipa
Copy link
Collaborator

sipa commented Oct 1, 2021

Merged as part of #51.

@sipa sipa closed this Oct 1, 2021
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

Successfully merging this pull request may close these issues.

2 participants