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

Remove uses of boost::rational with negative denominator in tests. #5347

Merged
merged 1 commit into from
Nov 5, 2018

Conversation

ekpyron
Copy link
Member

@ekpyron ekpyron commented Nov 5, 2018

boost 1.68.0 throws an exception when supplying negative denominators to the constructor of boost::rational.
I'm pretty confident that this is never done in the actual code (I had a look through all occurrences of rational), but only in the test case adjusted in this PR - if that's true, we can just remove these test cases, but maybe someone should recheck.

@ekpyron ekpyron self-assigned this Nov 5, 2018
@ekpyron
Copy link
Member Author

ekpyron commented Nov 5, 2018

Related issue in boost: boostorg/rational#27

This is in fact a bug in boost, but I still think it would be better if the 0.5.0 tests wouldn't fail against the current release of boost... Alternatively we could use boost version #ifdef's.

@codecov
Copy link

codecov bot commented Nov 5, 2018

Codecov Report

Merging #5347 into develop will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop   #5347      +/-   ##
==========================================
- Coverage       88%     88%   -0.01%     
==========================================
  Files          322     322              
  Lines        32491   32489       -2     
  Branches      3865    3865              
==========================================
- Hits         28595   28593       -2     
  Misses        2592    2592              
  Partials      1304    1304
Flag Coverage Δ
#all 88% <ø> (-0.01%) ⬇️
#syntax 27.9% <ø> (ø) ⬆️

chriseth
chriseth previously approved these changes Nov 5, 2018
Changelog.md Outdated
@@ -107,6 +107,7 @@ Compiler Features:
Bugfixes:
* Build System: Support versions of CVC4 linked against CLN instead of GMP. In case of compilation issues due to the experimental SMT solver support, the solvers can be disabled when configuring the project with CMake using ``-DUSE_CVC4=OFF`` or ``-DUSE_Z3=OFF``.
* Tests: Fix chain parameters to make ipc tests work with newer versions of cpp-ethereum.
* Tests: Do not use negative denominators for ``boost::rational`` in the test. This breaks for ``boost >= 1.68`` and negative denominators never actually occur.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I think this clutters the changelog unnecessarily.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah ok - I actually considered not adding an entry, but then added one regardless... I'll remove it.

@ekpyron
Copy link
Member Author

ekpyron commented Nov 5, 2018

Removed the Changelog entry.

@ekpyron ekpyron merged commit 88aee34 into develop Nov 5, 2018
@ekpyron ekpyron deleted the boostRationalNegativeDenominator branch November 5, 2018 20:59
@axic
Copy link
Member

axic commented Nov 5, 2018

I had a look through all occurrences of rational), but only in the test case adjusted in this PR

Did you add an assert for that?

@ekpyron
Copy link
Member Author

ekpyron commented Nov 5, 2018

Actually, I think I missed one place where the denominator might actually be negative during exponentiation - I'll verify and fix it (and add a test). It's the only place we use the constructor with a denominator at all, though, and since we can't add an assertion to boost I think with that upcoming change it'll be fine.

@ekpyron
Copy link
Member Author

ekpyron commented Nov 5, 2018

Yes, in fact (-1 / 2) ** (-1) triggers the exception.

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.

3 participants