Skip to content

Tuple destructuring is broken with closure iterators #15924

@a-mr

Description

@a-mr

Compiler crashes with --gc:orc or has an internal error:

Example

iterator walk(): (int, int) {.closure.} =
  yield (10,11)

for (i,j) in walk():
  echo i

Current Output

nim c --gc:orc myng7.nim
Hint: used config file '/home/amakarov/activity-public/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/amakarov/activity-public/Nim/config/config.nims' [Conf]
Hint: used config file '/home/amakarov/activity-personal/nim-try/nim.cfg' [Conf]
....SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

not to crash

Possible Solution

Additional Information

$ nim -v
Nim Compiler Version 1.5.1 [Linux: amd64]
Compiled at 2020-11-09
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: 53eca459f1d96c710238be95bd3fb048b336f2f3
active boot switches: -d:release

Possibly related with #15896.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions