-
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.
Adding better error message for bytecode verifier ability check, plus…
… displaying message in compiler pipeline. This also demonstrates the problem with bug #14813
- Loading branch information
Showing
11 changed files
with
121 additions
and
2 deletions.
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
46 changes: 46 additions & 0 deletions
46
third_party/move/move-compiler-v2/tests/file-format-generator/bug_14813_fun_call_ability.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,46 @@ | ||
|
||
Diagnostics: | ||
warning: Unused parameter `key`. Consider removing or prefixing with an underscore: `_key` | ||
┌─ tests/file-format-generator/bug_14813_fun_call_ability.move:9:40 | ||
│ | ||
9 │ fun search<V: drop>(self: &Map<V>, key: u256): bool { | ||
│ ^^^ | ||
|
||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v7 | ||
module 815.red_black_map { | ||
struct Map<phantom Ty0> has drop { | ||
dummy_field: bool | ||
} | ||
|
||
public contains<Ty0>(Arg0: &Map<Ty0>, Arg1: u256): bool /* def_idx: 0 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &Map<Ty0>) | ||
1: MoveLoc[1](Arg1: u256) | ||
2: Call search<Ty0>(&Map<Ty0>, u256): bool | ||
3: Ret | ||
} | ||
search<Ty0: drop>(Arg0: &Map<Ty0>, Arg1: u256): bool /* def_idx: 1 */ { | ||
B0: | ||
0: LdTrue | ||
1: MoveLoc[0](Arg0: &Map<Ty0>) | ||
2: Pop | ||
3: Ret | ||
} | ||
} | ||
============ bytecode verification failed ======== | ||
|
||
Diagnostics: | ||
bug: bytecode verification failed with unexpected status code `CONSTRAINT_NOT_SATISFIED`. This is a compiler bug, consider reporting it. | ||
Error message: missing abilities for `CallGeneric(0)` at code offset 2 | ||
┌─ tests/file-format-generator/bug_14813_fun_call_ability.move:1:1 | ||
│ | ||
1 │ ╭ module 0x815::red_black_map { | ||
2 │ │ | ||
3 │ │ struct Map<phantom V> has drop {} | ||
4 │ │ | ||
· │ | ||
11 │ │ } | ||
12 │ │ } | ||
│ ╰─^ |
12 changes: 12 additions & 0 deletions
12
...d_party/move/move-compiler-v2/tests/file-format-generator/bug_14813_fun_call_ability.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,12 @@ | ||
module 0x815::red_black_map { | ||
|
||
struct Map<phantom V> has drop {} | ||
|
||
public fun contains<V>(self: &Map<V>, key: u256): bool { | ||
self.search(key) | ||
} | ||
|
||
fun search<V: drop>(self: &Map<V>, key: u256): bool { | ||
true | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...arty/move/move-compiler-v2/tests/file-format-generator/bug_14813_fun_call_ability.opt.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,46 @@ | ||
|
||
Diagnostics: | ||
warning: Unused parameter `key`. Consider removing or prefixing with an underscore: `_key` | ||
┌─ tests/file-format-generator/bug_14813_fun_call_ability.move:9:40 | ||
│ | ||
9 │ fun search<V: drop>(self: &Map<V>, key: u256): bool { | ||
│ ^^^ | ||
|
||
|
||
============ disassembled file-format ================== | ||
// Move bytecode v7 | ||
module 815.red_black_map { | ||
struct Map<phantom Ty0> has drop { | ||
dummy_field: bool | ||
} | ||
|
||
public contains<Ty0>(Arg0: &Map<Ty0>, Arg1: u256): bool /* def_idx: 0 */ { | ||
B0: | ||
0: MoveLoc[0](Arg0: &Map<Ty0>) | ||
1: MoveLoc[1](Arg1: u256) | ||
2: Call search<Ty0>(&Map<Ty0>, u256): bool | ||
3: Ret | ||
} | ||
search<Ty0: drop>(Arg0: &Map<Ty0>, Arg1: u256): bool /* def_idx: 1 */ { | ||
B0: | ||
0: LdTrue | ||
1: MoveLoc[0](Arg0: &Map<Ty0>) | ||
2: Pop | ||
3: Ret | ||
} | ||
} | ||
============ bytecode verification failed ======== | ||
|
||
Diagnostics: | ||
bug: bytecode verification failed with unexpected status code `CONSTRAINT_NOT_SATISFIED`. This is a compiler bug, consider reporting it. | ||
Error message: missing abilities for `CallGeneric(0)` at code offset 2 | ||
┌─ tests/file-format-generator/bug_14813_fun_call_ability.move:1:1 | ||
│ | ||
1 │ ╭ module 0x815::red_black_map { | ||
2 │ │ | ||
3 │ │ struct Map<phantom V> has drop {} | ||
4 │ │ | ||
· │ | ||
11 │ │ } | ||
12 │ │ } | ||
│ ╰─^ |
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
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