forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#12193 from ethereum/use-src-ewasm-crash
Fix crash when using @use-src while compiling yul -> ewasm
- Loading branch information
Showing
6 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--strict-assembly --yul-dialect evm --machine ewasm --optimize --ewasm-ir |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Warning: Yul is still experimental. Please use the output with care. |
4 changes: 4 additions & 0 deletions
4
test/cmdlineTests/yul_to_wasm_source_location_crash/input.yul
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// @use-src 0:"test.sol" | ||
object "C" { | ||
code { sstore(0,0) } | ||
} |
34 changes: 34 additions & 0 deletions
34
test/cmdlineTests/yul_to_wasm_source_location_crash/output
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
|
||
======= yul_to_wasm_source_location_crash/input.yul (Ewasm) ======= | ||
|
||
========================== | ||
|
||
Translated source: | ||
/// @use-src 0:"test.sol" | ||
object "C" { | ||
code { | ||
function main() | ||
{ | ||
let hi := i64.shl(i64.extend_i32_u(bswap32(i32.wrap_i64(0))), 32) | ||
let y := i64.or(hi, i64.extend_i32_u(bswap32(i32.wrap_i64(i64.shr_u(0, 32))))) | ||
i64.store(0:i32, y) | ||
i64.store(i32.add(0:i32, 8:i32), y) | ||
i64.store(i32.add(0:i32, 16:i32), y) | ||
i64.store(i32.add(0:i32, 24:i32), y) | ||
i64.store(32:i32, y) | ||
i64.store(i32.add(32:i32, 8:i32), y) | ||
i64.store(i32.add(32:i32, 16:i32), y) | ||
i64.store(i32.add(32:i32, 24:i32), y) | ||
eth.storageStore(0:i32, 32:i32) | ||
} | ||
function bswap16(x:i32) -> y:i32 | ||
{ | ||
y := i32.or(i32.and(i32.shl(x, 8:i32), 0xff00:i32), i32.and(i32.shr_u(x, 8:i32), 0xff:i32)) | ||
} | ||
function bswap32(x:i32) -> y:i32 | ||
{ | ||
let hi:i32 := i32.shl(bswap16(x), 16:i32) | ||
y := i32.or(hi, bswap16(i32.shr_u(x, 16:i32))) | ||
} | ||
} | ||
} |