Skip to content

try-catch Fails to Handle Division by Zero at Runtime #2454

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

Closed
Gusarich opened this issue Mar 24, 2025 · 1 comment
Closed

try-catch Fails to Handle Division by Zero at Runtime #2454

Gusarich opened this issue Mar 24, 2025 · 1 comment
Labels
activity: llm-fuzzing Issues found using LLM fuzzing

Comments

@Gusarich
Copy link
Member

Gusarich commented Mar 24, 2025

Compiling the following minimal test snippet results in an immediate compilation error instead of either allowing the runtime try-catch mechanism to handle the division-by-zero condition, or throwing an tact-compile-time error:

fun test(x: Int): Int {
    try {
        return x / 0; // division by zero!
    } catch (exitCode) {
        return exitCode;
    }
}

contract Name {
    receive() {
        try {
            test(123);
        } catch (exitCode) {
            // exitCode is 4 ?
        }
    }
}

Actual Compiler Error:

FunC compilation error: cannot generate code for function `$global_test`:
/Users/daniil/Coding/tact-llm-fuzzing/test.tact_Name.fc:64:20: error: division by zero
          return ($x / 0);

LLM Fuzzing discovery (see #2490)

@anton-trunov
Copy link
Member

Duplicate of #716

@anton-trunov anton-trunov marked this as a duplicate of #716 Mar 24, 2025
@anton-trunov anton-trunov added the activity: llm-fuzzing Issues found using LLM fuzzing label Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activity: llm-fuzzing Issues found using LLM fuzzing
Projects
None yet
Development

No branches or pull requests

2 participants