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

Union typed generics causes error of cannot instantiate: 'T' #16153

Closed
binhonglee opened this issue Nov 27, 2020 · 7 comments · Fixed by #24525
Closed

Union typed generics causes error of cannot instantiate: 'T' #16153

binhonglee opened this issue Nov 27, 2020 · 7 comments · Fixed by #24525

Comments

@binhonglee
Copy link
Contributor

Function echo outputs the wrong string.

Example

type
  X*[T] = openArray[T] | varargs[T] | seq[T]
  Y*[T] = ref object
    dll: T

proc initY*[T](): Y[T] =
  new(result)

proc initY*[T](v: X[T]): Y[T] =
  new(result)
  for e in v:
    echo e

var deque: Y[int] = initY[int]()

https://play.nim-lang.org/#ix=2FBN

Current Output

Hint: used config file '/playground/nim/config/nim.cfg' [Conf]
Hint: used config file '/playground/nim/config/config.nims' [Conf]
....
/usercode/in.nim(14, 26) template/generic instantiation of `initY` from here
/usercode/in.nim(11, 12) template/generic instantiation of `items` from here
/playground/nim/lib/system/iterators.nim(6, 17) Error: cannot instantiate: 'T'

Expected Output

(Basically success compilation.)

Hint: used config file '/playground/nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: widestrs [Processing]
Hint: io [Processing]
Hint: in [Processing]
/usercode/in.nim(14, 5) Hint: 'deque' is declared but not used [XDeclaredButNotUsed]
Hint: gcc -c  -w   -I/playground/nim/lib -I/usercode -o /usercode/nimcache/stdlib_system.nim.c.o /usercode/nimcache/stdlib_system.nim.c [Exec]
Hint: gcc -c  -w   -I/playground/nim/lib -I/usercode -o /usercode/nimcache/@min.nim.c.o /usercode/nimcache/@min.nim.c [Exec]
Hint:  [Link]
Hint: 14312 LOC; 1.815 sec; 15.934MiB peakmem; Debug build; proj: /usercode/in.nim; out: /usercode/in [SuccessX]

Additional Information

This is a regression that worked fine on all the previous versions before 1.4.0 (since 0.19.0 according to playground).

@bung87
Copy link
Collaborator

bung87 commented Nov 29, 2022

it goes into iterator instantiateGenericParamList if q.typ.kind != tyCompositeTypeClass: which is tyGenericParam, even it pass here it will error type mismatch: got <openArray[T: not char]> which mismatch to func len*[TOpenArray: openArray|varargs](x: TOpenArray): int {.magic: "LengthOpenArray".}

well, the root cause is proc explicitGenericInstantiation a.kind is nkClosedSymChoice it try instantiate two procs.

@ringabout
Copy link
Member

@github-actions nim c

type
  X*[T] = openArray[T] | varargs[T] | seq[T]
  Y*[T] = ref object
    dll: T

proc initY*[T](): Y[T] =
  new(result)

proc initY*[T](v: X[T]): Y[T] =
  new(result)
  for e in v:
    echo e

var deque: Y[int] = initY[int]()

@ringabout
Copy link
Member

!nim c

type
  X*[T] = openArray[T] | varargs[T] | seq[T]
  Y*[T] = ref object
    dll: T

proc initY*[T](): Y[T] =
  new(result)

proc initY*[T](v: X[T]): Y[T] =
  new(result)
  for e in v:
    echo e

var deque: Y[int] = initY[int]()

Copy link
Contributor

🐧 Linux bisect by @ringabout (member)
devel 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(11, 26) template/generic instantiation of `initY` from here
/home/runner/work/Nim/Nim/temp.nim(9, 12) template/generic instantiation of `items` from here
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/iterators.nim(16, 17) Error: cannot instantiate: 'T'
assertions.nim(34)       raiseAssert
Error: unhandled exception: errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2023-11-20T14:19:45
  • Finished 2023-11-20T14:19:45
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("X")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("|"),
        nnkInfix.newTree(
          newIdentNode("|"),
          nnkBracketExpr.newTree(
            newIdentNode("openArray"),
            newIdentNode("T")
          ),
          nnkBracketExpr.newTree(
            newIdentNode("varargs"),
            newIdentNode("T")
          )
        ),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("T")
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Y")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("dll"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("v"),
        nnkBracketExpr.newTree(
          newIdentNode("X"),
          newIdentNode("T")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      ),
      nnkForStmt.newTree(
        newIdentNode("e"),
        newIdentNode("v"),
        nnkStmtList.newTree(
          nnkCommand.newTree(
            newIdentNode("echo"),
            newIdentNode("e")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("deque"),
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("int")
      ),
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("initY"),
          newIdentNode("int")
        )
      )
    )
  )
)
stable 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(11, 26) template/generic instantiation of `initY` from here
/home/runner/work/Nim/Nim/temp.nim(9, 12) template/generic instantiation of `items` from here
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/iterators.nim(11, 17) Error: cannot instantiate: 'T'
assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2023-11-20T14:19:46
  • Finished 2023-11-20T14:19:46
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("X")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("|"),
        nnkInfix.newTree(
          newIdentNode("|"),
          nnkBracketExpr.newTree(
            newIdentNode("openArray"),
            newIdentNode("T")
          ),
          nnkBracketExpr.newTree(
            newIdentNode("varargs"),
            newIdentNode("T")
          )
        ),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("T")
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Y")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("dll"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("v"),
        nnkBracketExpr.newTree(
          newIdentNode("X"),
          newIdentNode("T")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      ),
      nnkForStmt.newTree(
        newIdentNode("e"),
        newIdentNode("v"),
        nnkStmtList.newTree(
          nnkCommand.newTree(
            newIdentNode("echo"),
            newIdentNode("e")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("deque"),
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("int")
      ),
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("initY"),
          newIdentNode("int")
        )
      )
    )
  )
)
2.0.0 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(11, 26) template/generic instantiation of `initY` from here
/home/runner/work/Nim/Nim/temp.nim(9, 12) template/generic instantiation of `items` from here
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/iterators.nim(11, 17) Error: cannot instantiate: 'T'
assertions.nim(34)       raiseAssert
Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2023-11-20T14:19:46
  • Finished 2023-11-20T14:19:47
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("X")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("|"),
        nnkInfix.newTree(
          newIdentNode("|"),
          nnkBracketExpr.newTree(
            newIdentNode("openArray"),
            newIdentNode("T")
          ),
          nnkBracketExpr.newTree(
            newIdentNode("varargs"),
            newIdentNode("T")
          )
        ),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("T")
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Y")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("dll"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("v"),
        nnkBracketExpr.newTree(
          newIdentNode("X"),
          newIdentNode("T")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      ),
      nnkForStmt.newTree(
        newIdentNode("e"),
        newIdentNode("v"),
        nnkStmtList.newTree(
          nnkCommand.newTree(
            newIdentNode("echo"),
            newIdentNode("e")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("deque"),
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("int")
      ),
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("initY"),
          newIdentNode("int")
        )
      )
    )
  )
)
1.6.14 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(11, 26) template/generic instantiation of `initY` from here
/home/runner/work/Nim/Nim/temp.nim(9, 12) template/generic instantiation of `items` from here
/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/iterators.nim(6, 17) Error: cannot instantiate: 'T'
fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2023-11-20T14:19:49
  • Finished 2023-11-20T14:19:50
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("X")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("|"),
        nnkInfix.newTree(
          newIdentNode("|"),
          nnkBracketExpr.newTree(
            newIdentNode("openArray"),
            newIdentNode("T")
          ),
          nnkBracketExpr.newTree(
            newIdentNode("varargs"),
            newIdentNode("T")
          )
        ),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("T")
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Y")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("dll"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("v"),
        nnkBracketExpr.newTree(
          newIdentNode("X"),
          newIdentNode("T")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      ),
      nnkForStmt.newTree(
        newIdentNode("e"),
        newIdentNode("v"),
        nnkStmtList.newTree(
          nnkCommand.newTree(
            newIdentNode("echo"),
            newIdentNode("e")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("deque"),
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("int")
      ),
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("initY"),
          newIdentNode("int")
        )
      )
    )
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(11, 26) template/generic instantiation of `initY` from here
/home/runner/work/Nim/Nim/temp.nim(9, 12) template/generic instantiation of `items` from here
/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/iterators.nim(6, 17) Error: cannot instantiate: 'T'

IR

Compiled filesize 0 bytes (0 bytes)

Stats

  • Started 2023-11-20T14:19:52
  • Finished 2023-11-20T14:19:52
  • Duration

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("X")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkInfix.newTree(
        newIdentNode("|"),
        nnkInfix.newTree(
          newIdentNode("|"),
          nnkBracketExpr.newTree(
            newIdentNode("openArray"),
            newIdentNode("T")
          ),
          nnkBracketExpr.newTree(
            newIdentNode("varargs"),
            newIdentNode("T")
          )
        ),
        nnkBracketExpr.newTree(
          newIdentNode("seq"),
          newIdentNode("T")
        )
      )
    ),
    nnkTypeDef.newTree(
      nnkPostfix.newTree(
        newIdentNode("*"),
        newIdentNode("Y")
      ),
      nnkGenericParams.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("T"),
          newEmptyNode(),
          newEmptyNode()
        )
      ),
      nnkRefTy.newTree(
        nnkObjectTy.newTree(
          newEmptyNode(),
          newEmptyNode(),
          nnkRecList.newTree(
            nnkIdentDefs.newTree(
              newIdentNode("dll"),
              newIdentNode("T"),
              newEmptyNode()
            )
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("initY")
    ),
    newEmptyNode(),
    nnkGenericParams.newTree(
      nnkIdentDefs.newTree(
        newIdentNode("T"),
        newEmptyNode(),
        newEmptyNode()
      )
    ),
    nnkFormalParams.newTree(
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("T")
      ),
      nnkIdentDefs.newTree(
        newIdentNode("v"),
        nnkBracketExpr.newTree(
          newIdentNode("X"),
          newIdentNode("T")
        ),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkCall.newTree(
        newIdentNode("new"),
        newIdentNode("result")
      ),
      nnkForStmt.newTree(
        newIdentNode("e"),
        newIdentNode("v"),
        nnkStmtList.newTree(
          nnkCommand.newTree(
            newIdentNode("echo"),
            newIdentNode("e")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("deque"),
      nnkBracketExpr.newTree(
        newIdentNode("Y"),
        newIdentNode("int")
      ),
      nnkCall.newTree(
        nnkBracketExpr.newTree(
          newIdentNode("initY"),
          newIdentNode("int")
        )
      )
    )
  )
)
1.2.18 👍 OK

Output


IR

Compiled filesize 91.59 Kb (93,784 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA {
NI dll;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void);
N_LIB_PRIVATE N_NOINLINE(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(NI x, NI y);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE TNimType NTI__MZHWqsTU9c3Y1Dkj9aubtldA_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
N_LIB_PRIVATE TNimType NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_;
N_LIB_PRIVATE tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* deque__TcgeWyJay7RmcMwxTlkLSA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op) {
 tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* a;
 a = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)p;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)deque__TcgeWyJay7RmcMwxTlkLSA, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
  (*s).calldepth = ((NI16) 0);
 }
 goto LA1_;
 LA3_: ;
 {
  (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
 }
 LA1_: ;
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void) {
 tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* result;
 nimfr_("initY", "/home/runner/work/Nim/Nim/temp.nim");
 result = NIM_NIL;
 result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*) newObj((&NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_), sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA));
 popFrame();
 return result;
}
static N_INLINE(NI, pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system)(NI x, NI y) {
 NI result;
 nimfr_("+%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/arithm"
"etics.nim");
 result = (NI)0;
 result = ((NI) ((NU)((NU64)(((NU) (x))) + (NU64)(((NU) (y))))));
 popFrame();
 return result;
}
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("incRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 (*c).refcount = pluspercent___dgYAo7RfdUVVpvkfKDym8w_2system((*c).refcount, ((NI) 8));
 popFrame();
}
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/arithm"
"etics.nim");
 result = (NI)0;
 result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
 popFrame();
 return result;
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
 NI T1_;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = (NI)0;
 T1_ = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem(((NI) (ptrdiff_t) (usr)), ((NI) 16));
 result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y) {
 NIM_BOOL result;
 nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/compar"
"isons.nim");
 result = (NIM_BOOL)0;
 result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
 popFrame();
 return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 (*c).refcount = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem((*c).refcount, ((NI) 8));
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem((*c).refcount, ((NI) 8));
  if (!T3_) goto LA4_;
  rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
 }
 LA4_: ;
 popFrame();
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {
 nimfr_("asgnRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 {
  tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
  if (!!((src == NIM_NIL))) goto LA3_;
  T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
  T5_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(src);
  incRef__AT1eRuflKWyTTBdLjEDZbgsystem(T5_);
 }
 LA3_: ;
 {
  tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
  if (!!(((*dest) == NIM_NIL))) goto LA8_;
  T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
  T10_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem((*dest));
  decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T10_);
 }
 LA8_: ;
 (*dest) = src;
 popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 tempDatInit000();
 (*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 TFrame FR_; FR_.len = 0;
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
}
{
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 asgnRef((void**) (&deque__TcgeWyJay7RmcMwxTlkLSA), initY__Ja4X7bDn7MSrlTd9anwAaNg());
 popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
static TNimNode TM__SRd76hP9cMfCzdUO857UhQQ_0[1];
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA);
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.kind = 18;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.base = 0;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.flags = 3;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].kind = 1;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].offset = offsetof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA, dll);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].name = "dll";
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[0];
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.kind = 22;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.base = (&NTI__MZHWqsTU9c3Y1Dkj9aubtldA_);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.flags = 2;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.marker = Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q;
}

Stats

  • Started 2023-11-20T14:19:54
  • Finished 2023-11-20T14:19:55
  • Duration
1.0.10 👍 OK

Output


IR

Compiled filesize 86.62 Kb (88,696 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
struct tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA {
NI dll;
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void);
N_NIMCALL(void*, newObj)(TNimType* typ, NI size);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, asgnRef)(void** dest, void* src);
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* deque__TcgeWyJay7RmcMwxTlkLSA;
TNimType NTI__MZHWqsTU9c3Y1Dkj9aubtldA_;
extern TNimType NTI__rR5Bzr1D5krxoo1NcNyeMA_;
TNimType NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
static N_NIMCALL(void, Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q)(void* p, NI op) {
 tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* a;
 a = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)p;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)deque__TcgeWyJay7RmcMwxTlkLSA, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {	NI T1_;
 T1_ = (NI)0;
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
  T1_ = ((NI) 0);
 }
 goto LA2_;
 LA4_: ;
 {
  T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
 }
 LA2_: ;
 (*s).calldepth = ((NI16) (T1_));
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA9_: ;
}
static N_INLINE(void, popFrame)(void) {	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*, initY__Ja4X7bDn7MSrlTd9anwAaNg)(void) {	tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA* result;
 nimfr_("initY", "/home/runner/work/Nim/Nim/temp.nim");
 result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*)0;
 result = (tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*) newObj((&NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_), sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA));
 popFrame();
 return result;
}
static N_INLINE(void, incRef__AT1eRuflKWyTTBdLjEDZbgsystem)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {	nimfr_("incRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 (*c).refcount = (NI)((NU64)((*c).refcount) + (NU64)(((NI) 8)));
 popFrame();
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU64)(((NI) (ptrdiff_t) (usr))) - (NU64)(((NI) 16)))));
 popFrame();
 return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {	nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {	nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 (*c).refcount = (NI)((NU64)((*c).refcount) - (NU64)(((NI) 8)));
 {
  if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3_;
  rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
 }
 LA3_: ;
 popFrame();
}
static N_INLINE(void, asgnRef)(void** dest, void* src) {	nimfr_("asgnRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 {
  tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T5_;
  if (!!((src == NIM_NIL))) goto LA3_;
  T5_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
  T5_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(src);
  incRef__AT1eRuflKWyTTBdLjEDZbgsystem(T5_);
 }
 LA3_: ;
 {
  tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T10_;
  if (!!(((*dest) == NIM_NIL))) goto LA8_;
  T10_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
  T10_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem((*dest));
  decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T10_);
 }
 LA8_: ;
 (*dest) = src;
 popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {	nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 tempDatInit000();
 (*inner)();
}
N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
 asgnRef((void**) (&deque__TcgeWyJay7RmcMwxTlkLSA), initY__Ja4X7bDn7MSrlTd9anwAaNg());
 popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
static TNimNode TM__SRd76hP9cMfCzdUO857UhQQ_0[1];
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA);
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.kind = 18;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.base = 0;
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.flags = 3;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].kind = 1;
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].offset = offsetof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA, dll);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].typ = (&NTI__rR5Bzr1D5krxoo1NcNyeMA_);
TM__SRd76hP9cMfCzdUO857UhQQ_0[0].name = "dll";
NTI__MZHWqsTU9c3Y1Dkj9aubtldA_.node = &TM__SRd76hP9cMfCzdUO857UhQQ_0[0];
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.size = sizeof(tyObject_YcolonObjectType___MZHWqsTU9c3Y1Dkj9aubtldA*);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.kind = 22;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.base = (&NTI__MZHWqsTU9c3Y1Dkj9aubtldA_);
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.flags = 2;
NTI__eQCyNh9cMFzHBX9bl1NnTY5Q_.marker = Marker_tyRef__eQCyNh9cMFzHBX9bl1NnTY5Q;
}

Stats

  • Started 2023-11-20T14:19:57
  • Finished 2023-11-20T14:19:57
  • Duration
#e56d50d74 ➡️ 🐛

Diagnostics

jcosborn introduced a bug at 2020-09-18 04:21:37 -0500 on commit #e56d50d74 with message:

fix infinite recursion in typeRel (#15241)

* fix generic constraints

Co-authored-by: James Osborn <osborn@Jamess-MacBook-Pro.local>

The bug is in the files:

compiler/sigmatch.nim
tests/overload/toverload_various.nim

The bug can be in the commits:

(Diagnostics sometimes off-by-one).

Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 18.2
  • Created 2023-11-20T14:19:16Z
  • Comments 3
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 19 minutes bisecting 4744 commits at 243 commits per second

@metagn
Copy link
Collaborator

metagn commented Sep 23, 2024

Works now, guessing fixed by #24010?

@ringabout
Copy link
Member

!nim c

let code = """
type
  X*[T] = openArray[T] | varargs[T] | seq[T]
  Y*[T] = ref object
    dll: T

proc initY*[T](): Y[T] =
  new(result)

proc initY*[T](v: X[T]): Y[T] =
  new(result)
  for e in v:
    echo e

var deque: Y[int] = initY[int]()
"""

# foo()
writeFile("test.nim", code)

import std/osproc

let (_, exitCode) = execCmdEx("nim c -r test.nim")
doAssert exitCode != 0

Copy link
Contributor

🐧 Linux bisect by @ringabout (member)
devel 👎 FAIL

Output


IR

Compiled filesize 197.50 Kb (202,240 bytes)
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tyObject_StringTableObj__0P3m7501aN2ol2UKnK1guw tyObject_StringTableObj__0P3m7501aN2ol2UKnK1guw;
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
 NimStringV2 Field0;
 NI Field1;
};
typedef NU8 tySet_tyEnum_ProcessOption__9aCfVUyDFjLLn9an3vvc7WLw;
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__stdZsyncio_u530)(NimStringV2 filename_p0, NimStringV2 content_p1);
N_LIB_PRIVATE N_NIMCALL(tyTuple__XOVT24GHXwqiEj5GCsEGCA, execCmdEx__pureZosproc_u1989)(NimStringV2 command_p0, tySet_tyEnum_ProcessOption__9aCfVUyDFjLLn9an3vvc7WLw options_p1, tyObject_StringTableObj__0P3m7501aN2ol2UKnK1guw* env_p2, NimStringV2 workingDir_p3, NimStringV2 input_p4);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u235)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZosproc_u2033)(tyTuple__XOVT24GHXwqiEj5GCsEGCA* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4661)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
 NI cap;
 NIM_CHAR data[226];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = {(225 | NIM_STRLIT_FLAG), "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc initY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e\012var deque: Y[int] = initY[int]()\012"};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {225, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_2)};
static const struct {
 NI cap;
 NIM_CHAR data[9];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = {(8 | NIM_STRLIT_FLAG), "test.nim"};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {8, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_4)};
static const struct {
 NI cap;
 NIM_CHAR data[18];
} TM__SRd76hP9cMfCzdUO857UhQQ_6 = {(17 | NIM_STRLIT_FLAG), "nim c -r test.nim"};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_7 = {17, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_6)};
static const struct {
 NI cap;
 NIM_CHAR data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {(0 | NIM_STRLIT_FLAG), ""};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_9 = {0, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_8)};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_10 = {0, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_8)};
static const struct {
 NI cap;
 NIM_CHAR data[59];
} TM__SRd76hP9cMfCzdUO857UhQQ_11 = {(58 | NIM_STRLIT_FLAG), "/home/runner/work/Nim/Nim/temp.nim(18, 1) `exitCode != 0` "};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_12 = {58, ((NimStrPayload*) &TM__SRd76hP9cMfCzdUO857UhQQ_11)};
N_LIB_PRIVATE NimStringV2 code__temp_u1;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4443;
N_LIB_PRIVATE NI exitCode__temp_u4;
extern NIM_THREADVAR TFrame* framePtr__system_u2675;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4443);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int) 0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u2675 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16) 0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u2675).calldepth + ((NI16) 1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u2675;
 framePtr__system_u2675 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16) 2000))) goto LA8_;
  callDepthLimitReached__system_u4661();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u2675 = (*framePtr__system_u2675).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyTuple__XOVT24GHXwqiEj5GCsEGCA tmpTuple;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 nimZeroMem((void*)(&tmpTuple), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 code__temp_u1 = TM__SRd76hP9cMfCzdUO857UhQQ_3;
 writeFile__stdZsyncio_u530(TM__SRd76hP9cMfCzdUO857UhQQ_5, code__temp_u1);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 tmpTuple = execCmdEx__pureZosproc_u1989(TM__SRd76hP9cMfCzdUO857UhQQ_7, 10, ((tyObject_StringTableObj__0P3m7501aN2ol2UKnK1guw*) NIM_NIL), TM__SRd76hP9cMfCzdUO857UhQQ_9, TM__SRd76hP9cMfCzdUO857UhQQ_10);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 exitCode__temp_u4 = tmpTuple.Field1;
 {
  if (!(!((!((exitCode__temp_u4 == ((NI) 0))))))) goto LA4_;
  failedAssertImpl__stdZassertions_u235(TM__SRd76hP9cMfCzdUO857UhQQ_12);
  if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 }
LA4_: ;
 {
  LA1_:;
 }
 {
  eqdestroy___pureZosproc_u2033((&tmpTuple));
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 if (code__temp_u1.p && !(code__temp_u1.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(code__temp_u1.p);
}
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:01
  • Finished 2024-10-30T11:42:03
  • Duration 1 mins

AST

nnkStmtList.newTree(
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("code"),
      newEmptyNode(),
      newLit("  type\n    X*[T] = openArray[T] | varargs[T] | seq[T]\n    Y*[T] = ref object\n      dll: T\n  proc initY*[T](): Y[T] =\n    new(result)\n  proc initY*[T](v: X[T]): Y[T] =\n    new(result)\n    for e in v:\n      echo e\n  var deque: Y[int] = initY[int]()\n  ")
    )
  ),
  nnkCall.newTree(
    newIdentNode("writeFile"),
    newLit("test.nim"),
    newIdentNode("code")
  ),
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("osproc")
    )
  ),
  nnkLetSection.newTree(
    nnkVarTuple.newTree(
      newIdentNode("_"),
      newIdentNode("exitCode"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("execCmdEx"),
        newLit("nim c -r test.nim")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("doAssert"),
    nnkInfix.newTree(
      newIdentNode("!="),
      newIdentNode("exitCode"),
      newLit(0)
    )
  )
)
stable 👎 FAIL

Output


IR

Compiled filesize 197.47 Kb (202,208 bytes)
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tyObject_StringTableObj__KVv9bLPjapMDlTjtzx4W0mg tyObject_StringTableObj__KVv9bLPjapMDlTjtzx4W0mg;
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
 NimStringV2 Field0;
 NI Field1;
};
typedef NU8 tySet_tyEnum_ProcessOption__9buK9a9c4r9cYSYElxqQFL3smg;
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__stdZsyncio_u530)(NimStringV2 filename_p0, NimStringV2 content_p1);
N_LIB_PRIVATE N_NIMCALL(tyTuple__XOVT24GHXwqiEj5GCsEGCA, execCmdEx__pureZosproc_u1989)(NimStringV2 command_p0, tySet_tyEnum_ProcessOption__9buK9a9c4r9cYSYElxqQFL3smg options_p1, tyObject_StringTableObj__KVv9bLPjapMDlTjtzx4W0mg* env_p2, NimStringV2 workingDir_p3, NimStringV2 input_p4);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u235)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZosproc_u2033)(tyTuple__XOVT24GHXwqiEj5GCsEGCA* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot2dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[225+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 225 | NIM_STRLIT_FLAG, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc initY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e\012var deque: Y[int] = initY[int]()\012" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {225, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
static const struct {
NI cap; NIM_CHAR data[8+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 8 | NIM_STRLIT_FLAG, "test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {8, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
NI cap; NIM_CHAR data[17+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_6 = { 17 | NIM_STRLIT_FLAG, "nim c -r test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_7 = {17, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_6};
static const struct {
NI cap; NIM_CHAR data[0+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_9 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_10 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const struct {
NI cap; NIM_CHAR data[58+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_11 = { 58 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(18, 1) `exitCode != 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_12 = {58, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_11};
N_LIB_PRIVATE NimStringV2 code__temp_u1;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437;
N_LIB_PRIVATE NI exitCode__temp_u4;
extern NIM_THREADVAR TFrame* framePtr__system_u2669;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4437);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u2669;
 framePtr__system_u2669 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4655();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u2669 = (*framePtr__system_u2669).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot2dot0atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot2dot0atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyTuple__XOVT24GHXwqiEj5GCsEGCA tmpTuple;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 nimZeroMem((void*)(&tmpTuple), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 code__temp_u1 = TM__SRd76hP9cMfCzdUO857UhQQ_3;
 writeFile__stdZsyncio_u530(TM__SRd76hP9cMfCzdUO857UhQQ_5, code__temp_u1);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 tmpTuple = execCmdEx__pureZosproc_u1989(TM__SRd76hP9cMfCzdUO857UhQQ_7, 10, ((tyObject_StringTableObj__KVv9bLPjapMDlTjtzx4W0mg*) NIM_NIL), TM__SRd76hP9cMfCzdUO857UhQQ_9, TM__SRd76hP9cMfCzdUO857UhQQ_10);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 exitCode__temp_u4 = tmpTuple.Field1;
 {
  if (!!(!((exitCode__temp_u4 == ((NI)0))))) goto LA4_;
  failedAssertImpl__stdZassertions_u235(TM__SRd76hP9cMfCzdUO857UhQQ_12);
  if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 }
LA4_: ;
 {
  LA1_:;
 }
 {
  eqdestroy___pureZosproc_u2033((&tmpTuple));
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 if (code__temp_u1.p && !(code__temp_u1.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(code__temp_u1.p);
}
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:06
  • Finished 2024-10-30T11:42:08
  • Duration 1 mins

AST

nnkStmtList.newTree(
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("code"),
      newEmptyNode(),
      newLit("  type\n    X*[T] = openArray[T] | varargs[T] | seq[T]\n    Y*[T] = ref object\n      dll: T\n  proc initY*[T](): Y[T] =\n    new(result)\n  proc initY*[T](v: X[T]): Y[T] =\n    new(result)\n    for e in v:\n      echo e\n  var deque: Y[int] = initY[int]()\n  ")
    )
  ),
  nnkCall.newTree(
    newIdentNode("writeFile"),
    newLit("test.nim"),
    newIdentNode("code")
  ),
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("osproc")
    )
  ),
  nnkLetSection.newTree(
    nnkVarTuple.newTree(
      newIdentNode("_"),
      newIdentNode("exitCode"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("execCmdEx"),
        newLit("nim c -r test.nim")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("doAssert"),
    nnkInfix.newTree(
      newIdentNode("!="),
      newIdentNode("exitCode"),
      newLit(0)
    )
  )
)
2.0.10 👍 OK

Output


IR

Compiled filesize 197.37 Kb (202,104 bytes)
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tyObject_StringTableObj__p7uyWe9c2XCestpqANNVJmA tyObject_StringTableObj__p7uyWe9c2XCestpqANNVJmA;
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringV2 Field0;
NI Field1;
};
typedef NU8 tySet_tyEnum_ProcessOption__1BaStJTV9bKPUjyCV79btwzQ;
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__stdZsyncio_u530)(NimStringV2 filename_p0, NimStringV2 content_p1);
N_LIB_PRIVATE N_NIMCALL(tyTuple__XOVT24GHXwqiEj5GCsEGCA, execCmdEx__pureZosproc_u1972)(NimStringV2 command_p0, tySet_tyEnum_ProcessOption__1BaStJTV9bKPUjyCV79btwzQ options_p1, tyObject_StringTableObj__p7uyWe9c2XCestpqANNVJmA* env_p2, NimStringV2 workingDir_p3, NimStringV2 input_p4);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u270)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZosproc_u2016)(tyTuple__XOVT24GHXwqiEj5GCsEGCA* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot10atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[225+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 225 | NIM_STRLIT_FLAG, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc initY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e\012var deque: Y[int] = initY[int]()\012" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {225, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
static const struct {
NI cap; NIM_CHAR data[8+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 8 | NIM_STRLIT_FLAG, "test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {8, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
NI cap; NIM_CHAR data[17+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_6 = { 17 | NIM_STRLIT_FLAG, "nim c -r test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_7 = {17, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_6};
static const struct {
NI cap; NIM_CHAR data[0+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_9 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_10 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const struct {
NI cap; NIM_CHAR data[58+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_11 = { 58 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(18, 1) `exitCode != 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_12 = {58, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_11};
N_LIB_PRIVATE NimStringV2 code__temp_u1;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402;
N_LIB_PRIVATE NI exitCode__temp_u4;
extern NIM_THREADVAR TFrame* framePtr__system_u4059;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4402);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4059 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4059;
 framePtr__system_u4059 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4620();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4059 = (*framePtr__system_u4059).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot10atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot10atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyTuple__XOVT24GHXwqiEj5GCsEGCA tmpTuple;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 nimZeroMem((void*)(&tmpTuple), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 code__temp_u1 = TM__SRd76hP9cMfCzdUO857UhQQ_3;
 writeFile__stdZsyncio_u530(TM__SRd76hP9cMfCzdUO857UhQQ_5, code__temp_u1);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 tmpTuple = execCmdEx__pureZosproc_u1972(TM__SRd76hP9cMfCzdUO857UhQQ_7, 10, ((tyObject_StringTableObj__p7uyWe9c2XCestpqANNVJmA*) NIM_NIL), TM__SRd76hP9cMfCzdUO857UhQQ_9, TM__SRd76hP9cMfCzdUO857UhQQ_10);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 exitCode__temp_u4 = tmpTuple.Field1;
 {
  if (!!(!((exitCode__temp_u4 == ((NI)0))))) goto LA4_;
  failedAssertImpl__stdZassertions_u270(TM__SRd76hP9cMfCzdUO857UhQQ_12);
  if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 }
LA4_: ;
 {
  LA1_:;
 }
 {
  eqdestroy___pureZosproc_u2016((&tmpTuple));
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 if (code__temp_u1.p && !(code__temp_u1.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(code__temp_u1.p);
}
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:11
  • Finished 2024-10-30T11:42:12
  • Duration 1 mins
2.0.0 👍 OK

Output


IR

Compiled filesize 193.19 Kb (197,824 bytes)
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
typedef struct tyObject_StringTableObj__9aQVWDBodHNhkGlutyRtcOw tyObject_StringTableObj__9aQVWDBodHNhkGlutyRtcOw;
struct NimStrPayload {
 NI cap;
 NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
 NI len;
 NimStrPayload* p;
};
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringV2 Field0;
NI Field1;
};
typedef NU8 tySet_tyEnum_ProcessOption__OskndNPuFVug9cMKa9ct4N5w;
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__stdZsyncio_u532)(NimStringV2 filename_p0, NimStringV2 content_p1);
N_LIB_PRIVATE N_NIMCALL(tyTuple__XOVT24GHXwqiEj5GCsEGCA, execCmdEx__pureZosproc_u2027)(NimStringV2 command_p0, tySet_tyEnum_ProcessOption__OskndNPuFVug9cMKa9ct4N5w options_p1, tyObject_StringTableObj__9aQVWDBodHNhkGlutyRtcOw* env_p2, NimStringV2 workingDir_p3, NimStringV2 input_p4);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___pureZosproc_u2071)(tyTuple__XOVT24GHXwqiEj5GCsEGCA* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[225+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 225 | NIM_STRLIT_FLAG, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc initY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e\012var deque: Y[int] = initY[int]()\012" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {225, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
static const struct {
NI cap; NIM_CHAR data[8+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 8 | NIM_STRLIT_FLAG, "test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {8, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
NI cap; NIM_CHAR data[17+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_6 = { 17 | NIM_STRLIT_FLAG, "nim c -r test.nim" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_7 = {17, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_6};
static const struct {
NI cap; NIM_CHAR data[0+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = { 0 | NIM_STRLIT_FLAG, "" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_9 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_10 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_8};
static const struct {
NI cap; NIM_CHAR data[58+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_11 = { 58 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(18, 1) `exitCode != 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_12 = {58, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_11};
N_LIB_PRIVATE NimStringV2 code__temp_u1;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
N_LIB_PRIVATE NI exitCode__temp_u4;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (NIM_BOOL*)0;
 result = (&nimInErrorMode__system_u4389);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4006;
 framePtr__system_u4006 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4607();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyTuple__XOVT24GHXwqiEj5GCsEGCA tmpTuple;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
 nimZeroMem((void*)(&tmpTuple), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 code__temp_u1 = TM__SRd76hP9cMfCzdUO857UhQQ_3;
 writeFile__stdZsyncio_u532(TM__SRd76hP9cMfCzdUO857UhQQ_5, code__temp_u1);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 tmpTuple = execCmdEx__pureZosproc_u2027(TM__SRd76hP9cMfCzdUO857UhQQ_7, 10, ((tyObject_StringTableObj__9aQVWDBodHNhkGlutyRtcOw*) NIM_NIL), TM__SRd76hP9cMfCzdUO857UhQQ_9, TM__SRd76hP9cMfCzdUO857UhQQ_10);
 if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 exitCode__temp_u4 = tmpTuple.Field1;
 {
  if (!!(!((exitCode__temp_u4 == ((NI)0))))) goto LA4_;
  failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_12);
  if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
 }
LA4_: ;
 {
  LA1_:;
 }
 {
  oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
  eqdestroy___pureZosproc_u2071((&tmpTuple));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
  *nimErr_ = oldNimErrFin1_;
 }
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 if (code__temp_u1.p && !(code__temp_u1.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(code__temp_u1.p);
}
 BeforeRet_: ;
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:15
  • Finished 2024-10-30T11:42:16
  • Duration 1 mins
1.6.20 👍 OK

Output


IR

Compiled filesize 210.05 Kb (215,088 bytes)
#include "nimbase.h"
#include <string.h>
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__USbPc9alteBFOfRejw0IPYQ tyObject_Cell__USbPc9alteBFOfRejw0IPYQ;
typedef struct tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg;
typedef struct tyObject_GcHeap__t69aQjzxW7FmvOL7XpHLmyw tyObject_GcHeap__t69aQjzxW7FmvOL7XpHLmyw;
typedef struct tyObject_GcStack__rDlr9cRaEdNqxGR9croMEJNw tyObject_GcStack__rDlr9cRaEdNqxGR9croMEJNw;
typedef struct tyObject_MemRegion__D0dQEAx0h5Bhgc8Q6BW2Iw tyObject_MemRegion__D0dQEAx0h5Bhgc8Q6BW2Iw;
typedef struct tyObject_SmallChunk__O53kXtyFD7TDiEYwk5Td1Q tyObject_SmallChunk__O53kXtyFD7TDiEYwk5Td1Q;
typedef struct tyObject_BigChunk__yXMahKLrwWYxDO82eN9ba1w tyObject_BigChunk__yXMahKLrwWYxDO82eN9ba1w;
typedef struct tyObject_LLChunk__UJR9cDjZvibCSXo9aRj7SX9cQ tyObject_LLChunk__UJR9cDjZvibCSXo9aRj7SX9cQ;
typedef struct tyObject_IntSet__i7ywOkONvFvdahwK0NEBVQ tyObject_IntSet__i7ywOkONvFvdahwK0NEBVQ;
typedef struct tyObject_Trunk__KdFprq6T12mWzGalsCR7gg tyObject_Trunk__KdFprq6T12mWzGalsCR7gg;
typedef struct tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g;
typedef struct tyObject_HeapLinks__Bw0IMvdOVqyBxxH1ZmEDeg tyObject_HeapLinks__Bw0IMvdOVqyBxxH1ZmEDeg;
typedef struct tyTuple__59a7yNnUUaLYoYgMyTxCvyA tyTuple__59a7yNnUUaLYoYgMyTxCvyA;
typedef struct tyObject_GcStat__fGBxrB5bu5S0xC9brjmfkoQ tyObject_GcStat__fGBxrB5bu5S0xC9brjmfkoQ;
typedef struct tyObject_CellSet__UY9caB79b0qIHRObBn8A4WSA tyObject_CellSet__UY9caB79b0qIHRObBn8A4WSA;
typedef struct tyObject_PageDesc__j9aIB2yRpeIkPT6e1CrFY5g tyObject_PageDesc__j9aIB2yRpeIkPT6e1CrFY5g;
typedef struct tyObject_StringTableObj__g5rx0hEIWFWSMYZo0pFkqg tyObject_StringTableObj__g5rx0hEIWFWSMYZo0pFkqg;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind__b9brdfAMvuT12kv1MtmF3IQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__h29aLKtZInAIaLqhWRujWcA;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__b9brdfAMvuT12kv1MtmF3IQ kind;
tySet_tyEnum_TNimTypeFlag__h29aLKtZInAIaLqhWRujWcA flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__K6UETQxRj3HYBl69c6NhKig;
struct TNimNode {
tyEnum_TNimNodeKind__K6UETQxRj3HYBl69c6NhKig kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__USbPc9alteBFOfRejw0IPYQ {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__rDlr9cRaEdNqxGR9croMEJNw {
void* bottom;
};
struct tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg {
NI len;
NI cap;
tyObject_Cell__USbPc9alteBFOfRejw0IPYQ** d;
};
typedef tyObject_SmallChunk__O53kXtyFD7TDiEYwk5Td1Q* tyArray__am9ckwqC56M7ACKNToDQf8g[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__yXMahKLrwWYxDO82eN9ba1w* tyArray__dKp1AZMrWGPz9btzS7Vnpow[32];
typedef tyArray__dKp1AZMrWGPz9btzS7Vnpow tyArray__qtz48s7lyP6EI0JVCgNDLw[24];
typedef tyObject_Trunk__KdFprq6T12mWzGalsCR7gg* tyArray__n7OYK9anGXLKqT2bAWs4WmA[256];
struct tyObject_IntSet__i7ywOkONvFvdahwK0NEBVQ {
tyArray__n7OYK9anGXLKqT2bAWs4WmA data;
};
typedef tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g* tyArray__FZjlW9aArl8yDtsaKBHERDQ[2];
struct tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g {
tyArray__FZjlW9aArl8yDtsaKBHERDQ link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__59a7yNnUUaLYoYgMyTxCvyA {
tyObject_BigChunk__yXMahKLrwWYxDO82eN9ba1w* Field0;
NI Field1;
};
typedef tyTuple__59a7yNnUUaLYoYgMyTxCvyA tyArray__BxsOe7WmMYPypzw9cg9aWRFQ[30];
struct tyObject_HeapLinks__Bw0IMvdOVqyBxxH1ZmEDeg {
NI len;
tyArray__BxsOe7WmMYPypzw9cg9aWRFQ chunks;
tyObject_HeapLinks__Bw0IMvdOVqyBxxH1ZmEDeg* next;
};
struct tyObject_MemRegion__D0dQEAx0h5Bhgc8Q6BW2Iw {
NI minLargeObj;
NI maxLargeObj;
tyArray__am9ckwqC56M7ACKNToDQf8g freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__qtz48s7lyP6EI0JVCgNDLw matrix;
tyObject_LLChunk__UJR9cDjZvibCSXo9aRj7SX9cQ* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__i7ywOkONvFvdahwK0NEBVQ chunkStarts;
tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g* root;
tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g* deleted;
tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g* last;
tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__HGw0Fii3rdknN9aH9aqThc3g bottomData;
tyObject_HeapLinks__Bw0IMvdOVqyBxxH1ZmEDeg heapLinks;
};
struct tyObject_GcStat__fGBxrB5bu5S0xC9brjmfkoQ {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__UY9caB79b0qIHRObBn8A4WSA {
NI counter;
NI max;
tyObject_PageDesc__j9aIB2yRpeIkPT6e1CrFY5g* head;
tyObject_PageDesc__j9aIB2yRpeIkPT6e1CrFY5g** data;
};
struct tyObject_GcHeap__t69aQjzxW7FmvOL7XpHLmyw {
tyObject_GcStack__rDlr9cRaEdNqxGR9croMEJNw stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg zct;
tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg decStack;
tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg tempStack;
NI recGcLock;
tyObject_MemRegion__D0dQEAx0h5Bhgc8Q6BW2Iw region;
tyObject_GcStat__fGBxrB5bu5S0xC9brjmfkoQ stat;
tyObject_CellSet__UY9caB79b0qIHRObBn8A4WSA marked;
tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg additionalRoots;
NI gcThreadId;
};
typedef NU8 tySet_tyEnum_ProcessOption__aKwERgzGtdioj2ZEdjVk1A;
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__system_u5350)(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* c);
static N_INLINE(NI, minuspercent___system_u716)(NI x, NI y);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u2997)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL, ltpercent___system_u1005)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__system_u5348)(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_u5299)(tyObject_CellSeq__jRKHLJ9a9c5ErVSJdxK4Cpgg* s, tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* c);
static N_INLINE(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ*, usrToCell__system_u5305)(void* usr);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__systemZio_u477)(NimStringDesc* filename, NimStringDesc* content);
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__pureZosproc_u1218)(NimStringDesc* command, tySet_tyEnum_ProcessOption__aKwERgzGtdioj2ZEdjVk1A options, tyObject_StringTableObj__g5rx0hEIWFWSMYZo0pFkqg* env, NimStringDesc* workingDir, NimStringDesc* input, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__systemZassertions_u56)(NimStringDesc* msg);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystematsiodotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatsposixatsposixdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatsstreamsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatsosprocdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTIstring__77mFvmsOLKik79ci2hXkHEg_;
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc initY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e\012var deque: Y[int] = initY[int]()\012", 225);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "test.nim", 8);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_5, "nim c -r test.nim", 17);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_7, "/home/runner/work/Nim/Nim/temp.nim(18, 10) `exitCode != 0` ", 59);
N_LIB_PRIVATE NimStringDesc* code__temp_u1;
extern TFrame* framePtr__system_u2564;
extern tyObject_GcHeap__t69aQjzxW7FmvOL7XpHLmyw gch__system_u5252;
N_LIB_PRIVATE NimStringDesc* ___temp_u3;
N_LIB_PRIVATE NI exitCode__temp_u4;
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)code__temp_u1, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__system_u2564 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s).calldepth = ((NI16) 0);
 }
 goto LA1_;
 LA3_: ;
 {
  (*s).calldepth = (NI16)((*framePtr__system_u2564).calldepth + ((NI16) 1));
 }
 LA1_: ;
 (*s).prev = framePtr__system_u2564;
 framePtr__system_u2564 = s;
 {
  if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
  callDepthLimitReached__system_u2997();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u2564 = (*framePtr__system_u2564).prev;
}
static N_INLINE(NI, minuspercent___system_u716)(NI x, NI y) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/arithmetics.nim");
 result = (NI)0;
 result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, ltpercent___system_u1005)(NI x, NI y) {
 NIM_BOOL result;
 nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/comparisons.nim");
 result = (NIM_BOOL)0;
 result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
 popFrame();
 return result;
}
static N_INLINE(void, rtlAddZCT__system_u5348)(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* c) {
 nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/gc.nim");
 addZCT__system_u5299((&gch__system_u5252.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__system_u5350)(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* c) {
 nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/gc.nim");
 (*c).refcount = minuspercent___system_u716((*c).refcount, ((NI) 8));
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = ltpercent___system_u1005((*c).refcount, ((NI) 8));
  if (!T3_) goto LA4_;
  rtlAddZCT__system_u5348(c);
 }
 LA4_: ;
 popFrame();
}
static N_INLINE(tyObject_Cell__USbPc9alteBFOfRejw0IPYQ*, usrToCell__system_u5305)(void* usr) {
 tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* result;
 NI T1_;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/gc.nim");
 result = (tyObject_Cell__USbPc9alteBFOfRejw0IPYQ*)0;
 T1_ = (NI)0;
 T1_ = minuspercent___system_u716(((NI) (ptrdiff_t) (usr)), ((NI) 16));
 result = ((tyObject_Cell__USbPc9alteBFOfRejw0IPYQ*) (T1_));
 popFrame();
 return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
 tyObject_Cell__USbPc9alteBFOfRejw0IPYQ* T1_;
 nimfr_("nimGCunrefNoCycle", "/home/runner/.choosenim/toolchains/nim-1.6.20/lib/system/gc.nim");
 T1_ = (tyObject_Cell__USbPc9alteBFOfRejw0IPYQ*)0;
 T1_ = usrToCell__system_u5305(p);
 decRef__system_u5350(T1_);
 popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__systemZmemory_u7(p, ((int) 0), size);
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void) {
 nimGCvisit((void*)___temp_u3, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_Init000();
}
 N_LIB_PRIVATE int cmdCount;
 N_LIB_PRIVATE char** cmdLine;
 N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystematsiodotnim_DatInit000();
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000();
 initStackBottomWith((void *)&inner);
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000();
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatsposixatsposixdotnim_DatInit000();
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_DatInit000();
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatsstreamsdotnim_DatInit000();
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatsosprocdotnim_DatInit000();
 (*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 TFrame FR_; FR_.len = 0;
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_6);
}
{
 NimStringDesc* T1_;
 tyTuple__XOVT24GHXwqiEj5GCsEGCA T2_;
 NimStringDesc* T3_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 T1_ = NIM_NIL;
 T1_ = code__temp_u1; code__temp_u1 = copyStringRC1(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3));
 if (T1_) nimGCunrefNoCycle(T1_);
 writeFile__systemZio_u477(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4), code__temp_u1);
 nimZeroMem((void*)(&T2_), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 execCmdEx__pureZosproc_u1218(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_5), 10, ((tyObject_StringTableObj__g5rx0hEIWFWSMYZo0pFkqg*) NIM_NIL), ((NimStringDesc*) NIM_NIL), ((NimStringDesc*) NIM_NIL), (&T2_));
 T3_ = NIM_NIL;
 T3_ = ___temp_u3; ___temp_u3 = copyStringRC1(T2_.Field0);
 if (T3_) nimGCunrefNoCycle(T3_);
 exitCode__temp_u4 = T2_.Field1;
 {
  if (!!(!((exitCode__temp_u4 == ((NI) 0))))) goto LA6_;
  failedAssertImpl__systemZassertions_u56(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_7));
 }
 LA6_: ;
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:19
  • Finished 2024-10-30T11:42:20
  • Duration 1 mins
1.4.8 👍 OK

Output


IR

Compiled filesize 215.22 Kb (220,384 bytes)
#include "nimbase.h"
#include <string.h>
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
typedef struct tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SPr7N6UKfuF549bNPiUvSRw[256];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SPr7N6UKfuF549bNPiUvSRw freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
typedef NU8 tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__D6Pj9c29aCLEJP9beOWa08HYA)(NimStringDesc* filename, NimStringDesc* content);
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__130zQ9a9cS3YNDwoh0G9at3bw)(NimStringDesc* command, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options, tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg* env, NimStringDesc* workingDir, NimStringDesc* input, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_ioDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_posixDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_streamsDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osprocDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref"
" object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc i"
"nitY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e"
"\012var deque: Y[int] = initY[int]()\012", 225);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "test.nim", 8);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_5, "nim c -r test.nim", 17);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_7, "/home/runner/work/Nim/Nim/temp.nim(18, 10) `exitCode != 0` ", 59);
N_LIB_PRIVATE NimStringDesc* code__oT69bA2m29a7pvQn7f2NJhvQ;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
N_LIB_PRIVATE NimStringDesc* ___FtN4iS9bLWFzC8ZqGcmDc4Q;
N_LIB_PRIVATE NI exitCode__Q2nKo9cWSVYKDoR62gUc1hw;
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)code__oT69bA2m29a7pvQn7f2NJhvQ, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s).calldepth = ((NI16) 0);
 }
 goto LA1_;
 LA3_: ;
 {
  (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
 }
 LA1_: ;
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/arithme"
"tics.nim");
 result = (NI)0;
 result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y) {
 NIM_BOOL result;
 nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/compari"
"sons.nim");
 result = (NIM_BOOL)0;
 result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
 popFrame();
 return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/gc.nim");
 addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/gc.nim");
 (*c).refcount = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem((*c).refcount, ((NI) 8));
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem((*c).refcount, ((NI) 8));
  if (!T3_) goto LA4_;
  rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
 }
 LA4_: ;
 popFrame();
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
 NI T1_;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/gc.nim");
 result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = (NI)0;
 T1_ = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem(((NI) (ptrdiff_t) (usr)), ((NI) 16));
 result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
 popFrame();
 return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
 nimfr_("nimGCunrefNoCycle", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/gc.nim");
 T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(p);
 decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T1_);
 popFrame();
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void) {
 nimGCvisit((void*)___FtN4iS9bLWFzC8ZqGcmDc4Q, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
 stdlib_timesInit000();
 stdlib_osInit000();
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 stdlib_ioDatInit000();
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 stdlib_posixDatInit000();
 stdlib_timesDatInit000();
 stdlib_osDatInit000();
 stdlib_streamsDatInit000();
 stdlib_osprocDatInit000();
 (*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 TFrame FR_; FR_.len = 0;
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_6);
}
{
 NimStringDesc* T1_;
 tyTuple__XOVT24GHXwqiEj5GCsEGCA T2_;
 NimStringDesc* T3_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 T1_ = (NimStringDesc*)0;
 T1_ = code__oT69bA2m29a7pvQn7f2NJhvQ; code__oT69bA2m29a7pvQn7f2NJhvQ = copyStringRC1(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3));
 if (T1_) nimGCunrefNoCycle(T1_);
 writeFile__D6Pj9c29aCLEJP9beOWa08HYA(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4), code__oT69bA2m29a7pvQn7f2NJhvQ);
 nimZeroMem((void*)(&T2_), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 execCmdEx__130zQ9a9cS3YNDwoh0G9at3bw(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_5), 10, ((tyObject_StringTableObj__V5PVrt9bIxZEeV7lfvqqtNg*) NIM_NIL), ((NimStringDesc*) NIM_NIL), ((NimStringDesc*) NIM_NIL), (&T2_));
 T3_ = (NimStringDesc*)0;
 T3_ = ___FtN4iS9bLWFzC8ZqGcmDc4Q; ___FtN4iS9bLWFzC8ZqGcmDc4Q = copyStringRC1(T2_.Field0);
 if (T3_) nimGCunrefNoCycle(T3_);
 exitCode__Q2nKo9cWSVYKDoR62gUc1hw = T2_.Field1;
 {
  if (!!(!((exitCode__Q2nKo9cWSVYKDoR62gUc1hw == ((NI) 0))))) goto LA6_;
  failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_7));
 }
 LA6_: ;
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:22
  • Finished 2024-10-30T11:42:23
  • Duration 1 mins
1.2.18 👎 FAIL

Output


IR

Compiled filesize 210.74 Kb (215,800 bytes)
#include "nimbase.h"
#include <string.h>
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
typedef NU8 tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__D6Pj9c29aCLEJP9beOWa08HYA)(NimStringDesc* filename, NimStringDesc* content);
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__9cTpvDl4v9c9c9aFgpXBZMyDDA)(NimStringDesc* command, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_ioDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_posixDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_streamsDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osprocDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref"
" object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc i"
"nitY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e"
"\012var deque: Y[int] = initY[int]()\012", 225);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "test.nim", 8);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_5, "nim c -r test.nim", 17);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_7, "/home/runner/work/Nim/Nim/temp.nim(18, 10) `exitCode != 0` ", 59);
N_LIB_PRIVATE NimStringDesc* code__oT69bA2m29a7pvQn7f2NJhvQ;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
N_LIB_PRIVATE NimStringDesc* ___FtN4iS9bLWFzC8ZqGcmDc4Q;
N_LIB_PRIVATE NI exitCode__Q2nKo9cWSVYKDoR62gUc1hw;
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)code__oT69bA2m29a7pvQn7f2NJhvQ, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
  (*s).calldepth = ((NI16) 0);
 }
 goto LA1_;
 LA3_: ;
 {
  (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
 }
 LA1_: ;
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
static N_INLINE(NI, minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem)(NI x, NI y) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/arithm"
"etics.nim");
 result = (NI)0;
 result = ((NI) ((NU)((NU64)(((NU) (x))) - (NU64)(((NU) (y))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem)(NI x, NI y) {
 NIM_BOOL result;
 nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/compar"
"isons.nim");
 result = (NIM_BOOL)0;
 result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y))));
 popFrame();
 return result;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {
 nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 (*c).refcount = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem((*c).refcount, ((NI) 8));
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = ltpercent___hPljn3JCDQ00ua1R07X9bxQsystem((*c).refcount, ((NI) 8));
  if (!T3_) goto LA4_;
  rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
 }
 LA4_: ;
 popFrame();
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {
 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
 NI T1_;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = (NI)0;
 T1_ = minuspercent___dgYAo7RfdUVVpvkfKDym8wsystem(((NI) (ptrdiff_t) (usr)), ((NI) 16));
 result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) (T1_));
 popFrame();
 return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {
 tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
 nimfr_("nimGCunrefNoCycle", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/gc.nim");
 T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(p);
 decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T1_);
 popFrame();
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {
 nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void) {
 nimGCvisit((void*)___FtN4iS9bLWFzC8ZqGcmDc4Q, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
 nimGC_setStackBottom(locals);
}
N_LIB_PRIVATE void PreMainInner(void) {
 stdlib_timesInit000();
 stdlib_osInit000();
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 stdlib_ioDatInit000();
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 stdlib_posixDatInit000();
 stdlib_timesDatInit000();
 stdlib_osDatInit000();
 stdlib_streamsDatInit000();
 stdlib_osprocDatInit000();
 (*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 TFrame FR_; FR_.len = 0;
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_6);
}
{
 NimStringDesc* T1_;
 tyTuple__XOVT24GHXwqiEj5GCsEGCA T2_;
 NimStringDesc* T3_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 T1_ = NIM_NIL;
 T1_ = code__oT69bA2m29a7pvQn7f2NJhvQ; code__oT69bA2m29a7pvQn7f2NJhvQ = copyStringRC1(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3));
 if (T1_) nimGCunrefNoCycle(T1_);
 writeFile__D6Pj9c29aCLEJP9beOWa08HYA(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4), code__oT69bA2m29a7pvQn7f2NJhvQ);
 nimZeroMem((void*)(&T2_), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 execCmdEx__9cTpvDl4v9c9c9aFgpXBZMyDDA(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_5), 10, (&T2_));
 T3_ = NIM_NIL;
 T3_ = ___FtN4iS9bLWFzC8ZqGcmDc4Q; ___FtN4iS9bLWFzC8ZqGcmDc4Q = copyStringRC1(T2_.Field0);
 if (T3_) nimGCunrefNoCycle(T3_);
 exitCode__Q2nKo9cWSVYKDoR62gUc1hw = T2_.Field1;
 {
  if (!!(!((exitCode__Q2nKo9cWSVYKDoR62gUc1hw == ((NI) 0))))) goto LA6_;
  failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_7));
 }
 LA6_: ;
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:25
  • Finished 2024-10-30T11:42:27
  • Duration 1 mins

AST

nnkStmtList.newTree(
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("code"),
      newEmptyNode(),
      newLit("  type\n    X*[T] = openArray[T] | varargs[T] | seq[T]\n    Y*[T] = ref object\n      dll: T\n  proc initY*[T](): Y[T] =\n    new(result)\n  proc initY*[T](v: X[T]): Y[T] =\n    new(result)\n    for e in v:\n      echo e\n  var deque: Y[int] = initY[int]()\n  ")
    )
  ),
  nnkCall.newTree(
    newIdentNode("writeFile"),
    newLit("test.nim"),
    newIdentNode("code")
  ),
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("osproc")
    )
  ),
  nnkLetSection.newTree(
    nnkVarTuple.newTree(
      newIdentNode("_"),
      newIdentNode("exitCode"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("execCmdEx"),
        newLit("nim c -r test.nim")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("doAssert"),
    nnkInfix.newTree(
      newIdentNode("!="),
      newIdentNode("exitCode"),
      newLit(0)
    )
  )
)
1.0.10 👎 FAIL

Output


IR

Compiled filesize 197.78 Kb (202,528 bytes)
#include "nimbase.h"
#include <string.h>
#  define nimfr_(proc, file) \
 TFrame FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#  define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#  define nimln_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct NimStringDesc NimStringDesc;
typedef struct TGenericSeq TGenericSeq;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g;
typedef struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w;
typedef struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ;
typedef struct tyObject_GcStack__7fytPA5bBsob6See21YMRA tyObject_GcStack__7fytPA5bBsob6See21YMRA;
typedef struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg;
typedef struct tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ;
typedef struct tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg;
typedef struct tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw;
typedef struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA;
typedef struct tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw;
typedef struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw;
typedef struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg;
typedef struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyTuple__ujsjpB2O9cjj3uDHsXbnSzg;
typedef struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg;
typedef struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ;
typedef struct tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg;
typedef struct tyTuple__XOVT24GHXwqiEj5GCsEGCA tyTuple__XOVT24GHXwqiEj5GCsEGCA;
struct TGenericSeq {
NI len;
NI reserved;
};
struct NimStringDesc {
TGenericSeq Sup;
NIM_CHAR data[SEQ_DECL_SIZE];
};
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g {
NI refcount;
TNimType* typ;
};
struct tyObject_GcStack__7fytPA5bBsob6See21YMRA {
void* bottom;
};
struct tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w {
NI len;
NI cap;
tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g** d;
};
typedef tyObject_SmallChunk__tXn60W2f8h3jgAYdEmy5NQ* tyArray__SiRwrEKZdLgxqz9a9aoVBglg[512];
typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24];
typedef tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* tyArray__N1u1nqOgmuJN9cSZrnMHgOQ[32];
typedef tyArray__N1u1nqOgmuJN9cSZrnMHgOQ tyArray__B6durA4ZCi1xjJvRtyYxMg[24];
typedef tyObject_Trunk__W0r8S0Y3UGke6T9bIUWnnuw* tyArray__lh2A89ahMmYg9bCmpVaplLbA[256];
struct tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA {
tyArray__lh2A89ahMmYg9bCmpVaplLbA data;
};
typedef tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* tyArray__0aOLqZchNi8nWtMTi8ND8w[2];
struct tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw {
tyArray__0aOLqZchNi8nWtMTi8ND8w link;
NI key;
NI upperBound;
NI level;
};
struct tyTuple__ujsjpB2O9cjj3uDHsXbnSzg {
tyObject_BigChunk__Rv9c70Uhp2TytkX7eH78qEg* Field0;
NI Field1;
};
typedef tyTuple__ujsjpB2O9cjj3uDHsXbnSzg tyArray__LzOv2eCDGiceMKQstCLmhw[30];
struct tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg {
NI len;
tyArray__LzOv2eCDGiceMKQstCLmhw chunks;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg* next;
};
struct tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg {
NI minLargeObj;
NI maxLargeObj;
tyArray__SiRwrEKZdLgxqz9a9aoVBglg freeSmallChunks;
NU32 flBitmap;
tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap;
tyArray__B6durA4ZCi1xjJvRtyYxMg matrix;
tyObject_LLChunk__XsENErzHIZV9bhvyJx56wGw* llmem;
NI currMem;
NI maxMem;
NI freeMem;
NI occ;
NI lastSize;
tyObject_IntSet__EZObFrE3NC9bIb3YMkY9crZA chunkStarts;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* root;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* deleted;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* last;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw* freeAvlNodes;
NIM_BOOL locked;
NIM_BOOL blockChunkSizeIncrease;
NI nextChunkSize;
tyObject_AvlNode__IaqjtwKhxLEpvDS9bct9blEw bottomData;
tyObject_HeapLinks__PDV1HBZ8CQSQJC9aOBFNRSg heapLinks;
};
struct tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg {
NI stackScans;
NI cycleCollections;
NI maxThreshold;
NI maxStackSize;
NI maxStackCells;
NI cycleTableSize;
NI64 maxPause;
};
struct tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ {
NI counter;
NI max;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg* head;
tyObject_PageDesc__fublkgIY4LG3mT51LU2WHg** data;
};
struct tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ {
tyObject_GcStack__7fytPA5bBsob6See21YMRA stack;
NI cycleThreshold;
NI zctThreshold;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w zct;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w decStack;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w tempStack;
NI recGcLock;
tyObject_MemRegion__x81NhDv59b8ercDZ9bi85jyg region;
tyObject_GcStat__0RwLoVBHZPfUAcLczmfQAg stat;
tyObject_CellSet__jG87P0AI9aZtss9ccTYBIISQ marked;
tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w additionalRoots;
NI gcThreadId;
};
typedef NU8 tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA;
struct tyTuple__XOVT24GHXwqiEj5GCsEGCA {
NimStringDesc* Field0;
NI Field1;
};
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_NIMCALL(NimStringDesc*, copyStringRC1)(NimStringDesc* src);
static N_INLINE(void, nimGCunrefNoCycle)(void* p);
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
N_LIB_PRIVATE N_NOINLINE(void, addZCT__Y66tOYFjgwJ0k4aLz4bc0Q)(tyObject_CellSeq__Axo1XVm9aaQueTOldv8le5w* s, tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr);
N_LIB_PRIVATE N_NIMCALL(void, writeFile__D6Pj9c29aCLEJP9beOWa08HYA)(NimStringDesc* filename, NimStringDesc* content);
N_LIB_PRIVATE N_NIMCALL(void, execCmdEx__9cTpvDl4v9c9c9aFgpXBZMyDDA)(NimStringDesc* command, tySet_tyEnum_ProcessOption__bnU6W8LhTMnT4JaSWtGlSA options, tyTuple__XOVT24GHXwqiEj5GCsEGCA* Result);
static N_INLINE(void, nimZeroMem)(void* p, NI size);
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_ioDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_posixDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_streamsDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, stdlib_osprocDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
NimStringDesc* code__oT69bA2m29a7pvQn7f2NJhvQ;
extern TNimType NTI__77mFvmsOLKik79ci2hXkHEg_;
extern tyObject_GcHeap__1TRH1TZMaVZTnLNcIHuNFQ gch__IcYaEuuWivYAS86vFMTS3Q;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
NimStringDesc* ___FtN4iS9bLWFzC8ZqGcmDc4Q;
NI exitCode__Q2nKo9cWSVYKDoR62gUc1hw;
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "type\012  X*[T] = openArray[T] | varargs[T] | seq[T]\012  Y*[T] = ref"
" object\012    dll: T\012proc initY*[T](): Y[T] =\012  new(result)\012proc i"
"nitY*[T](v: X[T]): Y[T] =\012  new(result)\012  for e in v:\012    echo e"
"\012var deque: Y[int] = initY[int]()\012", 225);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "test.nim", 8);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_5, "nim c -r test.nim", 17);
STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_7, "/home/runner/work/Nim/Nim/temp.nim(18, 10) `exitCode != 0` ", 59);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
 nimGCvisit((void*)code__oT69bA2m29a7pvQn7f2NJhvQ, 0);
}
static N_INLINE(void, nimFrame)(TFrame* s) {	NI T1_;
 T1_ = (NI)0;
 {
  if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
  T1_ = ((NI) 0);
 }
 goto LA2_;
 LA4_: ;
 {
  T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
 }
 LA2_: ;
 (*s).calldepth = ((NI16) (T1_));
 (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
 framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
 {
  if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
  callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
 }
 LA9_: ;
}
static N_INLINE(void, popFrame)(void) {	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
static N_INLINE(void, rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {	nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 addZCT__Y66tOYFjgwJ0k4aLz4bc0Q((&gch__IcYaEuuWivYAS86vFMTS3Q.zct), c);
 popFrame();
}
static N_INLINE(void, decRef__AT1eRuflKWyTTBdLjEDZbg_2system)(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* c) {	nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 (*c).refcount = (NI)((NU64)((*c).refcount) - (NU64)(((NI) 8)));
 {
  if (!((NU64)((*c).refcount) < (NU64)(((NI) 8)))) goto LA3_;
  rtlAddZCT__AT1eRuflKWyTTBdLjEDZbg_3system(c);
 }
 LA3_: ;
 popFrame();
}
static N_INLINE(tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*, usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem)(void* usr) {	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* result;
 nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 result = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 result = ((tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*) ((NI)((NU64)(((NI) (ptrdiff_t) (usr))) - (NU64)(((NI) 16)))));
 popFrame();
 return result;
}
static N_INLINE(void, nimGCunrefNoCycle)(void* p) {	tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_;
 nimfr_("nimGCunrefNoCycle", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/gc.nim");
 T1_ = (tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g*)0;
 T1_ = usrToCell__QFQqcLB3lgOdwipkv9a60xwsystem(p);
 decRef__AT1eRuflKWyTTBdLjEDZbg_2system(T1_);
 popFrame();
}
static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) {	void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a, v, ((size_t) (size)));
}
static N_INLINE(void, nimZeroMem)(void* p, NI size) {	nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size);
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_6)(void) {
 nimGCvisit((void*)___FtN4iS9bLWFzC8ZqGcmDc4Q, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {	nimGC_setStackBottom(locals);
}
void PreMainInner(void) {
 stdlib_timesInit000();
 stdlib_osInit000();
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
 void (*volatile inner)(void);
 inner = PreMainInner;
 stdlib_ioDatInit000();
 systemDatInit000();
 initStackBottomWith((void *)&inner);
 systemInit000();
 stdlib_posixDatInit000();
 stdlib_timesDatInit000();
 stdlib_osDatInit000();
 stdlib_streamsDatInit000();
 stdlib_osprocDatInit000();
 (*inner)();
}
N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 initStackBottomWith((void *)&inner);
 (*inner)();
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 NimStringDesc* T1_;
 tyTuple__XOVT24GHXwqiEj5GCsEGCA T2_;
 NimStringDesc* T3_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
 nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_6);
 T1_ = (NimStringDesc*)0;
 T1_ = code__oT69bA2m29a7pvQn7f2NJhvQ; code__oT69bA2m29a7pvQn7f2NJhvQ = copyStringRC1(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3));
 if (T1_) nimGCunrefNoCycle(T1_);
 writeFile__D6Pj9c29aCLEJP9beOWa08HYA(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4), code__oT69bA2m29a7pvQn7f2NJhvQ);
 nimZeroMem((void*)(&T2_), sizeof(tyTuple__XOVT24GHXwqiEj5GCsEGCA));
 execCmdEx__9cTpvDl4v9c9c9aFgpXBZMyDDA(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_5), 10, (&T2_));
 T3_ = (NimStringDesc*)0;
 T3_ = ___FtN4iS9bLWFzC8ZqGcmDc4Q; ___FtN4iS9bLWFzC8ZqGcmDc4Q = copyStringRC1(T2_.Field0);
 if (T3_) nimGCunrefNoCycle(T3_);
 exitCode__Q2nKo9cWSVYKDoR62gUc1hw = T2_.Field1;
 {
  if (!!(!((exitCode__Q2nKo9cWSVYKDoR62gUc1hw == ((NI) 0))))) goto LA6_;
  failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_7));
 }
 LA6_: ;
 popFrame();
}
}

Stats

  • Started 2024-10-30T11:42:29
  • Finished 2024-10-30T11:42:30
  • Duration 1 mins

AST

nnkStmtList.newTree(
  nnkLetSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("code"),
      newEmptyNode(),
      newLit("  type\n    X*[T] = openArray[T] | varargs[T] | seq[T]\n    Y*[T] = ref object\n      dll: T\n  proc initY*[T](): Y[T] =\n    new(result)\n  proc initY*[T](v: X[T]): Y[T] =\n    new(result)\n    for e in v:\n      echo e\n  var deque: Y[int] = initY[int]()\n  ")
    )
  ),
  nnkCall.newTree(
    newIdentNode("writeFile"),
    newLit("test.nim"),
    newIdentNode("code")
  ),
  nnkImportStmt.newTree(
    nnkInfix.newTree(
      newIdentNode("/"),
      newIdentNode("std"),
      newIdentNode("osproc")
    )
  ),
  nnkLetSection.newTree(
    nnkVarTuple.newTree(
      newIdentNode("_"),
      newIdentNode("exitCode"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("execCmdEx"),
        newLit("nim c -r test.nim")
      )
    )
  ),
  nnkCommand.newTree(
    newIdentNode("doAssert"),
    nnkInfix.newTree(
      newIdentNode("!="),
      newIdentNode("exitCode"),
      newLit(0)
    )
  )
)
#71de7fca9 ➡️ 🐛

Diagnostics

metagn introduced a bug at 2024-09-02 19:22:20 +0300 on commit #71de7fca9 with message:

handle explicit generic routine instantiations in sigmatch (#24010)

fixes #16376

The way the compiler handled generic proc instantiations in calls (like
`foo[int](...)`) up to this point was to instantiate `foo[int]`, create
a symbol for the instantiated proc (or a symchoice for multiple procs
excluding ones with mismatching generic param counts), then perform
overload resolution on this symbol/symchoice. The exception to this was
when the called symbol was already a symchoice node, in which case it
wasn't instantiated and overloading was called directly ([these
lines](https://github.com/nim-lang/Nim/blob/b7b1313d21deb687adab2b4a162e716ba561a26b/compiler/semexprs.nim#L3366-L3371)).

This has several problems:

* Templates and macros can't create instantiated symbols, so they
couldn't participate in overloaded explicit generic instantiations,
causing the issue #16376.
* Every single proc that can be instantiated with the given generic
params is fully instantiated including the body. #9997 is about this but
isn't fixed here since the instantiation isn't in a call.

The way overload resolution handles explicit instantiations by itself is
also buggy:

* It doesn't check constraints.
* It allows only partially providing the generic parameters, which makes
sense for implicit generics, but can cause ambiguity in overloading.

Here is how this PR deals with these problems:

* Overload resolution now always handles explicit generic instantiations
in calls, in `initCandidate`, as long as the symbol resolves to a
routine symbol.
* Overload resolution now checks the generic params for constraints and
correct parameter count (ignoring implicit params). If these don't
match, the entire overload is considered as not matching and not
instantiated.
* Special error messages are added for mismatching/missing/extra generic
params. This is almost all of the diff in `semcall`.
* Procs with matching generic parameters now instantiate only the type
of the signature in overload resolution, not the proc itself, which also
works for templates and macros.

Unfortunately we can't entirely remove instantiations because overload
resolution can't handle some cases with uninstantiated types even though
it's resolved in the binding (see the last 2 blocks in
`texplicitgenerics`). There are also some instantiation issues with
default params that #24005 didn't fix but I didn't want this to become
the 3rd huge generics PR in a row so I didn't dive too deep into trying
to fix them. There is still a minor instantiation fix in `semtypinst`
though for subscripts in calls.

Additional changes:

* Overloading of `[]` wasn't documented properly, it somewhat is now
because we need to mention the limitation that it can't be done for
generic procs/types.
* Tests can now enable the new type mismatch errors with just
`-d:testsConciseTypeMismatch` in the command.

Package PRs:

- using fork for now:
[combparser](https://github.com/PMunch/combparser/pull/7) (partial
generic instantiation)
- merged: [cligen](https://github.com/c-blake/cligen/pull/233) (partial
generic instantiation but non-overloaded + template)
- merged: [neo](https://github.com/andreaferretti/neo/pull/56) (trying
to instantiate template with no generic param)

The bug is in the files:

compiler/ast.nim
compiler/sem.nim
compiler/semcall.nim
compiler/semdata.nim
compiler/semexprs.nim
compiler/seminst.nim
compiler/semtypinst.nim
compiler/sigmatch.nim
doc/manual.md
nimsuggest/tests/tgeneric_highlight.nim
testament/important_packages.nim
tests/ccgbugs/t20141.nim
tests/config.nims
tests/errmsgs/tconcisetypemismatch.nim
tests/errmsgs/tconcisetypemismatch.nims
tests/errmsgs/twrong_explicit_typeargs.nim
tests/errmsgs/twrong_explicit_typeargs_legacy.nim
tests/generics/timplicit_and_explicit.nim
tests/generics/twrong_explicit_typeargs.nim
tests/proc/texplicitgenericcount.nim
tests/proc/texplicitgenericcountverbose.nim
tests/proc/texplicitgenerics.nim

The bug can be in the commits:

(Diagnostics sometimes off-by-one).

Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-10-30T11:41:36Z
  • Comments 6
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 48 mins bisecting 1019 commits at 21 commits per second

metagn added a commit to metagn/Nim that referenced this issue Dec 8, 2024
@Araq Araq closed this as completed in aeb3fe9 Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants