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

division by zero panics cannot be recovered #1148

Open
thehowl opened this issue Sep 18, 2023 · 1 comment
Open

division by zero panics cannot be recovered #1148

thehowl opened this issue Sep 18, 2023 · 1 comment
Assignees
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🤖 gnovm Issues or PRs gnovm related

Comments

@thehowl
Copy link
Member

thehowl commented Sep 18, 2023

running the following program:

package main

func main() {
        defer func() {
                println("RECOVER", recover())
        }()
        p := 0
        println(11 / p)
}

it panics with panic running expression main(): runtime error: integer divide by zero. This is to be expected, however seeing as we have a deferred function with recover, this should ideally be catchable by said function.

@petar-dambovaliev
Copy link
Contributor

With further investigation, it seems like this is a more general problem where only explicit panics are handled when the user code has a function call to panic.
The implicit panics are not handled.

slice := []int{1, 2, 3}
println(slice[5])

And

make([]int, -1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working in focus Core team is prioritizing this work 📦 🤖 gnovm Issues or PRs gnovm related
Projects
Status: In Progress
Development

No branches or pull requests

5 participants