-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
bugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triagedteam:compilerCompiler TeamCompiler Team
Description
E.g., the below script will fail with:
Internal compiler error: Verification failed: Function in_array_2 return type must match its RET instructions.
script;
fn in_array() -> u64 {
let _ = [return, return];
42
}
fn in_length_1_array() -> u64 {
let _ = [return];
42
}
fn in_length_2_array_first() -> u64 {
let _ = [return, 0];
42
}
fn in_length_2_array_second() -> u64 {
let _ = [0, return];
42
}
fn main() {
let _ = in_array();
let _ = in_length_1_array();
let _ = in_length_2_array_first();
let _ = in_length_2_array_second();
}
The ICE appears also if we return any mismatched type. E.g., having everywhere return true
.
The expected behavior is the one we have in the should_fail/return_in_non_statement_positions
test - type mismatched error should be emitted.
The should_fail/return_in_non_statement_positions
is currently disabled. This is very likely the reason we didn't spot this issue before. That test is being adapted and will be enabled in the upcoming PR that finalizes #7276.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triagedteam:compilerCompiler TeamCompiler Team