-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-v2] Fix bytecode verification error due to incorrect const …
…folding (#15982)
- Loading branch information
Showing
5 changed files
with
166 additions
and
35 deletions.
There are no files selected for viewing
80 changes: 55 additions & 25 deletions
80
third_party/move/move-compiler-v2/tests/folding/unfoldable_constants.exp
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
40 changes: 35 additions & 5 deletions
40
third_party/move/move-compiler-v2/tests/folding/unfoldable_constants_blocks.exp
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
23 changes: 23 additions & 0 deletions
23
third_party/move/move-compiler-v2/transactional-tests/tests/misc/invalid_shift_in_consts.exp
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,23 @@ | ||
comparison between v1 and v2 failed: | ||
= processed 1 task | ||
= | ||
= task 0 'publish'. lines 1-9: | ||
- Error: error[E08001]: cannot compute constant value | ||
+ Error: compilation errors: | ||
+ error: Invalid expression in `const`. Operand on the right is too large for `<<`, should be less than `8` | ||
= ┌─ TEMPFILE:3:20 | ||
= │ | ||
= 3 │ const C1: u8 = 0 << 8; | ||
- │ ^^^^^^ Invalid expression in 'const'. This expression could not be evaluated to a value | ||
+ │ ^^^^^^ | ||
= | ||
- error[E08001]: cannot compute constant value | ||
+ error: Invalid expression in `const`. Operand on the right is too large for `>>`, should be less than `8` | ||
= ┌─ TEMPFILE:4:20 | ||
= │ | ||
= 4 │ const C2: u8 = 0 >> 8; | ||
- │ ^^^^^^ Invalid expression in 'const'. This expression could not be evaluated to a value | ||
+ │ ^^^^^^ | ||
= | ||
= | ||
= |
9 changes: 9 additions & 0 deletions
9
...d_party/move/move-compiler-v2/transactional-tests/tests/misc/invalid_shift_in_consts.move
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,9 @@ | ||
//# publish | ||
module 0xc0ffee::m { | ||
const C1: u8 = 0 << 8; | ||
const C2: u8 = 0 >> 8; | ||
|
||
public fun test(): u8 { | ||
C1 + C2 | ||
} | ||
} |
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