mirror of
https://github.com/pezkuwichain/revive.git
synced 2026-04-22 04:27:58 +00:00
llvm-context: bugfix PHI values in SAR builtin translation (#345)
Closes #344 Signed-off-by: xermicus <cyrill@parity.io>
This commit is contained in:
@@ -6,6 +6,18 @@ This is a development pre-release.
|
||||
|
||||
Supported `polkadot-sdk` rev: `2503.0.1`
|
||||
|
||||
## v0.3.0
|
||||
|
||||
This is a development pre-release.
|
||||
|
||||
Supported `polkadot-sdk` rev: `2503.0.1`
|
||||
|
||||
### Fixed
|
||||
|
||||
- llvm-context: Bugfix the SAR YUL builtin translation.
|
||||
- npm package: Bugfix the exports field defined in the `package.json`.
|
||||
|
||||
|
||||
## v0.2.0
|
||||
|
||||
This is a development pre-release.
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8;
|
||||
|
||||
/* runner.json
|
||||
{
|
||||
"differential": true,
|
||||
"actions": [
|
||||
{
|
||||
"Instantiate": {
|
||||
"code": {
|
||||
"Solidity": {
|
||||
"contract": "SAR"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
contract SAR {
|
||||
constructor() payable {
|
||||
assert(sar(0x03, 0x01) == 0x01);
|
||||
assert(
|
||||
sar(
|
||||
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x01
|
||||
) == 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
);
|
||||
assert(
|
||||
sar(
|
||||
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0xff
|
||||
) == 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
);
|
||||
assert(
|
||||
sar(
|
||||
0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff,
|
||||
0x100
|
||||
) == 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
||||
);
|
||||
}
|
||||
|
||||
function sar(uint256 a, uint256 b) public pure returns (uint256 c) {
|
||||
assembly {
|
||||
c := sar(b, a)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -60,6 +60,7 @@ test_spec!(mload, "MLoad", "MLoad.sol");
|
||||
test_spec!(delegate_no_contract, "DelegateCaller", "DelegateCaller.sol");
|
||||
test_spec!(function_type, "FunctionType", "FunctionType.sol");
|
||||
test_spec!(layout_at, "LayoutAt", "LayoutAt.sol");
|
||||
test_spec!(shift_arithmetic_right, "SAR", "SAR.sol");
|
||||
|
||||
fn instantiate(path: &str, contract: &str) -> Vec<SpecsAction> {
|
||||
vec![Instantiate {
|
||||
|
||||
@@ -204,7 +204,7 @@ where
|
||||
&context.word_type().const_all_ones(),
|
||||
overflow_negative_block,
|
||||
),
|
||||
(&context.word_const(0), overflow_block),
|
||||
(&context.word_const(0), overflow_positive_block),
|
||||
]);
|
||||
Ok(result.as_basic_value())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user