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

regression(0.20): `finally` block executed twice in VM #11610

timotheecour opened this issue Jun 28, 2019 · 0 comments


Copy link

commented Jun 28, 2019

finally block is executed twice in VM
Likewise with defer.


proc main()=
    echo "main:begin"
  finally: # same problem if using `defer`
    echo "main:done"

static: main() # compile time: has the bug
main() # runtime: will be correct

Current Output

nim c $timn_D/tests/nim/all/t0453.nim


Expected Output


Additional Information

This worked in 0.19.6, fails in 0.20 or nim devel d72edfb
After bisection, this is the commit that introduces the regression: 710cfce
note that that PR #10544 was fixing another exception handling VM bug but it introduced this regression /cc @LemonBoy

note: for bisection, I had to checkout previous csources to rebuild nim; having csources as a git submodule would makes this a bit easier (we'd just do something like: git checkout $hash && git submodule update and it would pick up the correct version of csources, starting from the point where submodule was introduced)

Araq added a commit that referenced this issue Jul 4, 2019

@Araq Araq closed this in 28c9c06 Jul 5, 2019

narimiran added a commit that referenced this issue Jul 8, 2019

fixes #11610 (#11659)
(cherry picked from commit 28c9c06)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.