Created
May 7, 2020 01:59
-
-
Save jwasinger/5c0a292b94e29abb71dc6cadf24192e8 to your computer and use it in GitHub Desktop.
Yul stack check (possible) bug
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
code { | |
function memcpy_384(dst, src) | |
{ | |
let hi := mload(src) | |
let lo := mload(add(src, 32)) | |
mstore(dst, hi) | |
mstore(add(dst, 32), lo) | |
} | |
function f2m_add(x_0, x_1, y_0, y_1, r_0, r_1, modulus) | |
{ | |
memcpy_384(r_0, x_0) | |
memcpy_384(r_1, x_1) | |
addmod384(r_0, y_0, modulus) | |
addmod384(r_1, y_1, modulus) | |
} | |
function f2m_sub(x_0, x_1, y_0, y_1, r_0, r_1, modulus) | |
{ | |
memcpy_384(r_0, x_0) | |
memcpy_384(r_1, x_1) | |
submod384(r_0, y_0, modulus) | |
submod384(r_1, y_1, modulus) | |
} | |
function f2m_mul(x_0_offset, x_1_offset, y_0_offset, y_1_offset, r_0, r_1, modulus, inv, mem) | |
{ | |
let A := mem | |
let B := add(mem, 64) | |
let C := add(B, 64) | |
let D := add(C, 64) | |
memcpy_384(A, x_0_offset) | |
mulmodmont384(A, y_0_offset, modulus, inv) | |
memcpy_384(B, x_1_offset) | |
mulmodmont384(B, y_1_offset, modulus, inv) | |
memcpy_384(C, x_0_offset) | |
addmod384(C, x_1_offset, modulus) | |
memcpy_384(D, y_0_offset) | |
addmod384(D, y_1_offset, modulus) | |
mulmodmont384(C, D, modulus, inv) | |
mstore(x_0_offset, 0x0000000000000000000000000000000000000000000000000000000000000000) | |
mstore(add(x_0_offset, 32), 0x0000000000000000000000000000000000000000000000000000000000000000) | |
submod384(r_0, B, modulus) | |
addmod384(B, A, modulus) | |
submod384(C, B, modulus) | |
memcpy_384(r_1, C) | |
} | |
function f6m_mul(x, y, r, inv, modulus) | |
{ | |
let mem_end := msize() | |
let aA_0 := mem_end | |
let aA_1 := add(aA_0, 64) | |
:Exception while assembling: /solidity/libyul/backends/evm/EVMCodeTransform.cpp(600): Throw in function void solidity::yul::CodeTransform::operator()(const solidity::yul::Block&) | |
Dynamic exception type: boost::wrapexcept<solidity::yul::StackTooDeepError> | |
std::exception::what: Variable y is 1 slot(s) too deep inside the stack. | |
[solidity::util::tag_comment*] = Variable y is 1 slot(s) too deep inside the stack. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment