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 since 1.4.2: vm crash with lists.SinglyLinkedRing #16384

Closed
timotheecour opened this issue Dec 17, 2020 · 2 comments · Fixed by #17126
Closed

regression since 1.4.2: vm crash with lists.SinglyLinkedRing #16384

timotheecour opened this issue Dec 17, 2020 · 2 comments · Fixed by #17126
Labels

Comments

@timotheecour
Copy link
Member

timotheecour commented Dec 17, 2020

Example

import lists

template fn() =
  var L: SinglyLinkedRing[int]
  L.prepend(4)
  doAssert $L == "[4]" # ok

  L.prepend(4)
  doAssert $L == "[4, 4]" # bug: crash wo stacktrace or error

static: fn() # bug
fn() # ok

Current Output

crashes with no output if running via choosenim nim shim
crashes with segmentation fault (no output) if running without nim shim on devel nim binary or 1.4.2, eg:
[1] 97786 segmentation fault nim r main.nim

Expected Output

works

Additional Information

1.4.2:
[1] 97786 segmentation fault nim r main
devel 5d8f862 1.5.1:
ditto

1.4.0:
works

discovered while reviewing #16362 and was trying to wrap test inside the classic pattern:

template main =
  # all the tests here
main()
static: main()

which is yet another argument while this pattern is useful, as it'd have prevented this regression

@Araq
Copy link
Member

Araq commented Dec 18, 2020

which is yet another argument while this pattern is useful, as it'd have prevented this regression

I don't remember anybody disliking this pattern, it's good.

@ringabout
Copy link
Member

The regression is introduced by this PR https://github.com/nim-lang/Nim/pull/15724/files

Araq pushed a commit that referenced this issue Mar 3, 2021
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
narimiran pushed a commit that referenced this issue Mar 18, 2021
(cherry picked from commit 6391f6e)
ringabout added a commit to ringabout/Nim that referenced this issue Mar 22, 2021
ardek66 pushed a commit to ardek66/Nim that referenced this issue Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants