Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages with the same opcodes are not detected #482

Closed
anton-trunov opened this issue Jun 25, 2024 · 0 comments · Fixed by #493
Closed

Messages with the same opcodes are not detected #482

anton-trunov opened this issue Jun 25, 2024 · 0 comments · Fixed by #493
Assignees
Labels
bug Something isn't working or isn't right scope: codegen Code generation, a.k.a. compiler backend typechecker
Milestone

Comments

@anton-trunov
Copy link
Member

Consider the following Tact code:

message(1) Msg1 {}
message(1) Msg2 {}

contract Example {
    receive(msg: Msg1) { }
    receive(msg: Msg2) { }
}

The message opcode clash results in the following incorrect FunC code that essentially ignores the Msg2 receiver.

;; Parse incoming message
int op = 0;
if (slice_bits(in_msg) >= 32) {
    op = in_msg.preload_uint(32);
}

;; Receive Msg1 message
if (op == 1) {
    var msg = in_msg~$Msg1$_load();
    self~$Example$_internal_binary_Msg1(msg);
    return (self, true);
}

;; Receive Msg2 message
if (op == 1) {
    var msg = in_msg~$Msg2$_load();
    self~$Example$_internal_binary_Msg2(msg);
    return (self, true);
}
@anton-trunov anton-trunov added bug Something isn't working or isn't right typechecker labels Jun 25, 2024
@anton-trunov anton-trunov added this to the v1.4.1 milestone Jun 25, 2024
@anton-trunov anton-trunov self-assigned this Jun 25, 2024
@anton-trunov anton-trunov added the scope: codegen Code generation, a.k.a. compiler backend label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working or isn't right scope: codegen Code generation, a.k.a. compiler backend typechecker
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant