argotorg / argotorg/solidity

Boost exception from emscripten binary: `Testing individual bits in negative values is not supported - results are undefined`

Open
#13,924 2 comments 0 reactions 2 assignees Claimed by @matheusaaguiar View on GitHub
bug :bug: medium effort medium impact must have
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

Running `solcjs --bin Test.sol` produces:
```
Unknown exception during compilation: /emsdk/upstream/emscripten/cache/sysroot/usr/include/boost/multiprecision/cpp_int/misc.hpp(243): Throw in function typename enable_if_c>::value, unsigned int>::type boost::multiprecision::backends::eval_msb(const cpp_int_backend &) [MinBits1 = 0U, MaxBits1 = 0U, SignType1 = boost::multiprecision::signed_magnitude, Checked1 = boost::multiprecision::unchecked, Allocator1 = std::allocator]
Dynamic exception type: boost::wrapexcept
std::exception::what: Testing individual bits in negative values is not supported - results are undefined.
```
Here is Test.sol:
```
contract Test {

function test() public pure
{
(10634634426792001081101511178246987599623141251366189690016263.62 % 1766847064778384329583297500742918515827483896875618958121606201292619775);
}
}
```
This compiles successfully when using both v.0.8.15 and v0.8.18 of solc. `solc --bin-runtime Test.sol`:
```
======= Test.sol:Test =======
Binary of the runtime part:
6080604052348015600f57600080fd5b506004361060285760003560e01c8063f8a8fd6d14602d575b600080fd5b00fea26469706673582212209f0712d626ee13ac18ddfe6a4900a33bf14d8eae22facc01962e1a3e96f5e95f64736f6c634300080f0033
```

```
$ solcjs --version
0.8.16+commit.07a7930e.Emscripten.clang
```
This was run on Ubuntu 20.04.5 LTS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.