nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.58k stars 1.47k forks source link

slice assignment doesn't work when converter is present #22970

Open veksha opened 11 months ago

veksha commented 11 months ago

Description

In my full program i have the following converter toString. (though this small example i don't even use strings) later in the code i have slice assignment query[0..1] = @[byte 8,8].

code compiled fine with Nim 1.x

converter toString(a: seq[byte]): string {.inline.} = cast[ptr string](a.addr)[]

var query = @[byte 1,2,3]
query[0..1] = @[byte 8,8]
echo query # outputs: @[8, 8, 3]

Nim Version

Nim Compiler Version 2.1.1 [Windows: amd64] Compiled at 2023-11-19 Copyright (c) 2006-2023 by Andreas Rumpf

git hash: cecaf9c56b1240a44a4de837e03694a0c55ec379 active boot switches: -d:release

Current Output

test.nim(4, 6) template/generic instantiation of `[]=` from here
D:\Programm\Nim\Nim-devel\lib\system\indices.nim(158, 15) template/generic instantiation of `spliceImpl` from here
D:\Programm\Nim\Nim-devel\lib\system\indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to

Expected Output

@[8, 8, 3]

Possible Solution

No response

Additional Information

please see forum thread https://forum.nim-lang.org/t/10655 for more info.

veksha commented 11 months ago

comment on the forum by janAkali:

Converters enable implicit conversion. And combined with templates it causes unexpected results:
template inspect(a: typed) =
  if a is seq and a.len > 0:
    if a[0] is byte:
      echo "It is a sequence of bytes!"
    elif a[0] is char:
      echo "It is a sequence of chars!"
    else:
      echo "It is something else."

converter `toString`(a: seq[byte]): string = cast[ptr string](a.addr)[]

echo char is byte # false
inspect(@[byte 1, 2, 3]) # compiles and outputs: it is a sequence of chars!
ringabout commented 10 months ago

!nim c

converter toString(a: seq[byte]): string {.inline.} = cast[ptr string](a.addr)[]

var query = @[byte 1,2,3]
query[0..1] = @[byte 8,8]
echo query # outputs: @[8, 8, 3]
github-actions[bot] commented 10 months ago
:penguin: Linux bisect by @ringabout (member)
devel :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-#devel/lib/system/indices.nim(161, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-#devel/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:48
  • Finished 2023-12-18T11:20:48
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
stable :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(158, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:49
  • Finished 2023-12-18T11:20:49
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
2.0.0 :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(158, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:49
  • Finished 2023-12-18T11:20:50
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
1.6.14 :-1: 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(1, 72) Error: expression has no address; maybe use 'unsafeAddr' fatal.nim(54) sysFatal Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:52
  • Finished 2023-12-18T11:20:53
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
1.4.8 :-1: 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(1, 72) Error: expression has no address; maybe use 'unsafeAddr' ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:55
  • Finished 2023-12-18T11:20:55
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
1.2.18 :-1: 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(1, 72) Error: expression has no address; maybe use 'unsafeAddr' ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:57
  • Finished 2023-12-18T11:20:57
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
1.0.10 :-1: 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(1, 72) Error: expression has no address; maybe use 'unsafeAddr' ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:20:59
  • Finished 2023-12-18T11:20:59
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("addr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 19.0
  • Created 2023-12-18T11:20:17Z
  • Comments 2
  • 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

:robot: Bug found in 14 minutes bisecting 7 commits at 0 commits per second

veksha commented 10 months ago

1.6.14 👎 FAIL Error: expression has no address; maybe use 'unsafeAddr'

maybe i used unsafeAddr back then.

ringabout commented 10 months ago

!nim c

converter toString(a: seq[byte]): string {.inline.} = cast[ptr string](a.unsafeAddr)[]

var query = @[byte 1,2,3]
query[0..1] = @[byte 8,8]
echo query # outputs: @[8, 8, 3]
github-actions[bot] commented 10 months ago
:penguin: Linux bisect by @ringabout (member)
devel :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-#devel/lib/system/indices.nim(161, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-#devel/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:53:20
  • Finished 2023-12-18T11:53:20
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("unsafeAddr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
stable :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(158, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:53:21
  • Finished 2023-12-18T11:53:21
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("unsafeAddr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
2.0.0 :-1: 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(3, 6) template/generic instantiation of `[]=` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(158, 15) template/generic instantiation of `spliceImpl` from here /home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/indices.nim(68, 56) Error: 's[i`gensym0]' cannot be assigned to assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 0 bytes (0 bytes) ```cpp ```

Stats

  • Started 2023-12-18T11:53:21
  • Finished 2023-12-18T11:53:22
  • Duration

AST

```nim nnkStmtList.newTree( nnkConverterDef.newTree( newIdentNode("toString"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newIdentNode("string"), nnkIdentDefs.newTree( newIdentNode("a"), nnkBracketExpr.newTree( newIdentNode("seq"), newIdentNode("byte") ), newEmptyNode() ) ), nnkPragma.newTree( newIdentNode("inline") ), newEmptyNode(), nnkStmtList.newTree( nnkBracketExpr.newTree( nnkCast.newTree( nnkPtrTy.newTree( newIdentNode("string") ), nnkDotExpr.newTree( newIdentNode("a"), newIdentNode("unsafeAddr") ) ) ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("query"), newEmptyNode(), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(1) ), newLit(2), newLit(3) ) ) ) ), nnkAsgn.newTree( nnkBracketExpr.newTree( newIdentNode("query"), nnkInfix.newTree( newIdentNode(".."), newLit(0), newLit(1) ) ), nnkPrefix.newTree( newIdentNode("@"), nnkBracket.newTree( nnkCommand.newTree( newIdentNode("byte"), newLit(8) ), newLit(8) ) ) ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("query") ) ) ```
1.6.14 :+1: OK

Output

``` @[8, 8, 3] ```

IR

Compiled filesize 109.23 Kb (111,848 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # 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 tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ; typedef struct TGenericSeq TGenericSeq; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q; typedef struct tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg; typedef struct tyObject_GcHeap__TNN37TDOIST9cBHBYNA9bZrQ tyObject_GcHeap__TNN37TDOIST9cBHBYNA9bZrQ; typedef struct tyObject_GcStack__kyxCHsHBs9aixKn7J6EMoKg tyObject_GcStack__kyxCHsHBs9aixKn7J6EMoKg; typedef struct tyObject_MemRegion__kTihTuGP022tKEZ5qSTY4g tyObject_MemRegion__kTihTuGP022tKEZ5qSTY4g; typedef struct tyObject_SmallChunk__sj9b0POpZpf2pwHAngQ4iuA tyObject_SmallChunk__sj9b0POpZpf2pwHAngQ4iuA; typedef struct tyObject_BigChunk__n43IpccPD6dfYiSGXsXF0A tyObject_BigChunk__n43IpccPD6dfYiSGXsXF0A; typedef struct tyObject_LLChunk__EAcyYaYsVdVpPDOJNXsVvA tyObject_LLChunk__EAcyYaYsVdVpPDOJNXsVvA; typedef struct tyObject_IntSet__BjiVv2xFwTJmbeWeHvjYQw tyObject_IntSet__BjiVv2xFwTJmbeWeHvjYQw; typedef struct tyObject_Trunk__N5u9b3R0O3g59awa8B9bs6qyg tyObject_Trunk__N5u9b3R0O3g59awa8B9bs6qyg; typedef struct tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg; typedef struct tyObject_HeapLinks__vrDr51n9cXj8aHnS73vhJqw tyObject_HeapLinks__vrDr51n9cXj8aHnS73vhJqw; typedef struct tyTuple__6nVTvmjorcAWafHl9cWGFuA tyTuple__6nVTvmjorcAWafHl9cWGFuA; typedef struct tyObject_GcStat__yGmLruPXMhFV80y1jxAtjg tyObject_GcStat__yGmLruPXMhFV80y1jxAtjg; typedef struct tyObject_CellSet__9co1sTf9aTPixSgG0AQ20mAA tyObject_CellSet__9co1sTf9aTPixSgG0AQ20mAA; typedef struct tyObject_PageDesc__i0uwYov8PyHfnx0dx0lOMQ tyObject_PageDesc__i0uwYov8PyHfnx0dx0lOMQ; typedef struct tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ; typedef struct NimStringDesc NimStringDesc; struct TGenericSeq { NI len; NI reserved; }; typedef NU8 tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ; typedef NU8 tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA; 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__3rC59cFdCULJbp2tHLSZMXQ kind; tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; typedef NU8 tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w; struct TNimNode { tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w kind; NI offset; TNimType* typ; NCSTRING name; NI len; TNimNode** sons; }; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q { NI refcount; TNimType* typ; }; struct tyObject_GcStack__kyxCHsHBs9aixKn7J6EMoKg { void* bottom; }; struct tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg { NI len; NI cap; tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q** d; }; typedef tyObject_SmallChunk__sj9b0POpZpf2pwHAngQ4iuA* tyArray__VYTQW7wK07xvH5Z4opKI1w[256]; typedef NU32 tyArray__BHbOSqU1t9b3Gt7K2c6fQig[24]; typedef tyObject_BigChunk__n43IpccPD6dfYiSGXsXF0A* tyArray__YkUf1j9c9b6JzhUdDj7S3KQA[32]; typedef tyArray__YkUf1j9c9b6JzhUdDj7S3KQA tyArray__MQbMf9bcijUF9a14VvUbfzqg[24]; typedef tyObject_Trunk__N5u9b3R0O3g59awa8B9bs6qyg* tyArray__sCQfOQF0EdBvLpqvNeg1Mg[256]; struct tyObject_IntSet__BjiVv2xFwTJmbeWeHvjYQw { tyArray__sCQfOQF0EdBvLpqvNeg1Mg data; }; typedef tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg* tyArray__Wt2k1c1BbnQ6Nj3SrdvfCw[2]; struct tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg { tyArray__Wt2k1c1BbnQ6Nj3SrdvfCw link; NI key; NI upperBound; NI level; }; struct tyTuple__6nVTvmjorcAWafHl9cWGFuA { tyObject_BigChunk__n43IpccPD6dfYiSGXsXF0A* Field0; NI Field1; }; typedef tyTuple__6nVTvmjorcAWafHl9cWGFuA tyArray__yUjlcLC9c9aIvr4MhTCDBnnA[30]; struct tyObject_HeapLinks__vrDr51n9cXj8aHnS73vhJqw { NI len; tyArray__yUjlcLC9c9aIvr4MhTCDBnnA chunks; tyObject_HeapLinks__vrDr51n9cXj8aHnS73vhJqw* next; }; struct tyObject_MemRegion__kTihTuGP022tKEZ5qSTY4g { NI minLargeObj; NI maxLargeObj; tyArray__VYTQW7wK07xvH5Z4opKI1w freeSmallChunks; NU32 flBitmap; tyArray__BHbOSqU1t9b3Gt7K2c6fQig slBitmap; tyArray__MQbMf9bcijUF9a14VvUbfzqg matrix; tyObject_LLChunk__EAcyYaYsVdVpPDOJNXsVvA* llmem; NI currMem; NI maxMem; NI freeMem; NI occ; NI lastSize; tyObject_IntSet__BjiVv2xFwTJmbeWeHvjYQw chunkStarts; tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg* root; tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg* deleted; tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg* last; tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg* freeAvlNodes; NIM_BOOL locked; NIM_BOOL blockChunkSizeIncrease; NI nextChunkSize; tyObject_AvlNode__OVssjMzF9b6dF0OdhUI9bjqg bottomData; tyObject_HeapLinks__vrDr51n9cXj8aHnS73vhJqw heapLinks; }; struct tyObject_GcStat__yGmLruPXMhFV80y1jxAtjg { NI stackScans; NI cycleCollections; NI maxThreshold; NI maxStackSize; NI maxStackCells; NI cycleTableSize; NI64 maxPause; }; struct tyObject_CellSet__9co1sTf9aTPixSgG0AQ20mAA { NI counter; NI max; tyObject_PageDesc__i0uwYov8PyHfnx0dx0lOMQ* head; tyObject_PageDesc__i0uwYov8PyHfnx0dx0lOMQ** data; }; struct tyObject_GcHeap__TNN37TDOIST9cBHBYNA9bZrQ { tyObject_GcStack__kyxCHsHBs9aixKn7J6EMoKg stack; NI cycleThreshold; NI zctThreshold; tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg zct; tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg decStack; tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg tempStack; NI recGcLock; tyObject_MemRegion__kTihTuGP022tKEZ5qSTY4g region; tyObject_GcStat__yGmLruPXMhFV80y1jxAtjg stat; tyObject_CellSet__9co1sTf9aTPixSgG0AQ20mAA marked; tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg additionalRoots; NI gcThreadId; }; struct tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ { NI a; NI b; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ { TGenericSeq Sup; NU8 data[SEQ_DECL_SIZE]; }; static N_NIMCALL(void, Marker_tySequence__6H5Oh5UUvVCLiakt9aTwtUQ)(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); static N_INLINE(void, nimGCunrefNoCycle)(void* p); static N_INLINE(void, decRef__system_5347)(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* c); static N_INLINE(NI, minuspercent___system_716)(NI x, NI y); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_2997)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(NIM_BOOL, ltpercent___system_1005)(NI x, NI y); static N_INLINE(void, rtlAddZCT__system_5345)(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* c); N_LIB_PRIVATE N_NOINLINE(void, addZCT__system_5296)(tyObject_CellSeq__8bh1syZiHlRn5s9cNSwuRKg* s, tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* c); static N_INLINE(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q*, usrToCell__system_5302)(void* usr); N_LIB_PRIVATE N_NIMCALL(void*, newSeqRC1)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(void, X5BX5Deq___temp_54)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ** s, tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ x, NU8* b, NI bLen_0); static N_INLINE(tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ, dotdot___temp_18)(NI a, NI b); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___temp_181)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmtempdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); extern TNimType NTIbyte__k3HXouOuhqAKq0dx450lXQ_; N_LIB_PRIVATE TNimType NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_; N_LIB_PRIVATE tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* query__temp_17; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern tyObject_GcHeap__TNN37TDOIST9cBHBYNA9bZrQ gch__system_5249; static N_NIMCALL(void, Marker_tySequence__6H5Oh5UUvVCLiakt9aTwtUQ)(void* p, NI op) { tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* a; NI T1_; a = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*)p; T1_ = (NI)0; } static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) { nimGCvisit((void*)query__temp_17, 0); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_2564 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_2564).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_2564; framePtr__system_2564 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_2997(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_2564 = (*framePtr__system_2564).prev; } static N_INLINE(NI, minuspercent___system_716)(NI x, NI y) { NI result; nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-1.6.14/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_1005)(NI x, NI y) { NIM_BOOL result; nimfr_("<%", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/comparisons.nim"); result = (NIM_BOOL)0; result = ((NU64)(((NU) (x))) < (NU64)(((NU) (y)))); popFrame(); return result; } static N_INLINE(void, rtlAddZCT__system_5345)(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* c) { nimfr_("rtlAddZCT", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/gc.nim"); addZCT__system_5296((&gch__system_5249.zct), c); popFrame(); } static N_INLINE(void, decRef__system_5347)(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* c) { nimfr_("decRef", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/gc.nim"); (*c).refcount = minuspercent___system_716((*c).refcount, ((NI) 8)); { NIM_BOOL T3_; T3_ = (NIM_BOOL)0; T3_ = ltpercent___system_1005((*c).refcount, ((NI) 8)); if (!T3_) goto LA4_; rtlAddZCT__system_5345(c); } LA4_: ; popFrame(); } static N_INLINE(tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q*, usrToCell__system_5302)(void* usr) { tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* result; NI T1_; nimfr_("usrToCell", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/gc.nim"); result = (tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q*)0; T1_ = (NI)0; T1_ = minuspercent___system_716(((NI) (ptrdiff_t) (usr)), ((NI) 16)); result = ((tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q*) (T1_)); popFrame(); return result; } static N_INLINE(void, nimGCunrefNoCycle)(void* p) { tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q* T1_; nimfr_("nimGCunrefNoCycle", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/gc.nim"); T1_ = (tyObject_Cell__vT0lLseQRZ19aq7BbaJzO4Q*)0; T1_ = usrToCell__system_5302(p); decRef__system_5347(T1_); popFrame(); } static N_INLINE(void, nimSetMem__systemZmemory_7)(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_7(p, ((int) 0), size); } static N_INLINE(tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ, dotdot___temp_18)(NI a, NI b) { tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ result; nimfr_("..", "/home/runner/.choosenim/toolchains/nim-1.6.14/lib/system.nim"); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ)); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ)); result.a = a; result.b = b; popFrame(); return result; } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000(); atmtempdotnim_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); } { tyObject_HSlice__ZwT1AdT5SpvzfXpu31YpBQ T1_; tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* T2_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); if (query__temp_17) { nimGCunrefNoCycle(query__temp_17); query__temp_17 = NIM_NIL; } query__temp_17 = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeqRC1((&NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_), 3); query__temp_17->data[0] = ((NU8) 1); query__temp_17->data[1] = ((NU8) 2); query__temp_17->data[2] = ((NU8) 3); T1_ = dotdot___temp_18(((NI) 0), ((NI) 1)); T2_ = NIM_NIL; T2_ = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeq((&NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_), 2); T2_->data[0] = ((NU8) 8); T2_->data[1] = ((NU8) 8); X5BX5Deq___temp_54((&query__temp_17), T1_, (T2_) ? (T2_->data) : NIM_NIL, (T2_ ? T2_->Sup.len : 0)); nimZeroMem((void*)T3_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T3_[0] = dollar___temp_181(query__temp_17); echoBinSafe(T3_, 1); popFrame(); } } N_LIB_PRIVATE N_NIMCALL(void, atmtempdotnim_DatInit000)(void) { NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.size = sizeof(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*); NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.align = NIM_ALIGNOF(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*); NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.kind = 24; NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.base = (&NTIbyte__k3HXouOuhqAKq0dx450lXQ_); NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.flags = 2; NTIseqLbyteT__6H5Oh5UUvVCLiakt9aTwtUQ_.marker = Marker_tySequence__6H5Oh5UUvVCLiakt9aTwtUQ; } ```

Stats

  • Started 2023-12-18T11:53:24
  • Finished 2023-12-18T11:53:25
  • Duration
1.4.8 :+1: OK

Output

``` @[8, 8, 3] ```

IR

Compiled filesize 106.20 Kb (108,744 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # 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 tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ; 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_HSlice__EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA; typedef struct NimStringDesc NimStringDesc; struct TGenericSeq { NI len; NI reserved; }; 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; }; struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA { NI a; NI b; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ { TGenericSeq Sup; NU8 data[SEQ_DECL_SIZE]; }; 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); static N_INLINE(void, nimGCunrefRC1)(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*, newSeqRC1)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(void, X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ** s, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA x, NU8* b, NI bLen_0); static N_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___zMVAqVKur1IdGuBDQciPBg)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); 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, NimMainModule)(void); extern TNimType NTI__6H5Oh5UUvVCLiakt9aTwtUQ_; N_LIB_PRIVATE tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* query__A5Uv2n1VS9bfwvtTb9ahvZhw; 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, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) { nimGCvisit((void*)query__A5Uv2n1VS9bfwvtTb9ahvZhw, 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, nimGCunrefRC1)(void* p) { tyObject_Cell__1zcF9cV8XIAtbN8h5HRUB8g* T1_; nimfr_("nimGCunrefRC1", "/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_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b) { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA result; nimfr_("..", "/home/runner/.choosenim/toolchains/nim-1.4.8/lib/system.nim"); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); result.a = a; result.b = b; popFrame(); return result; } 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(); (*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); } { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA T1_; tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* T2_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); if (query__A5Uv2n1VS9bfwvtTb9ahvZhw) { nimGCunrefRC1(query__A5Uv2n1VS9bfwvtTb9ahvZhw); query__A5Uv2n1VS9bfwvtTb9ahvZhw = NIM_NIL; } query__A5Uv2n1VS9bfwvtTb9ahvZhw = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeqRC1((&NTI__6H5Oh5UUvVCLiakt9aTwtUQ_), 3); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[0] = ((NU8) 1); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[1] = ((NU8) 2); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[2] = ((NU8) 3); T1_ = dotdot___BokNSDrKN1xmV1nA01G9brAsystem(((NI) 0), ((NI) 1)); T2_ = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*)0; T2_ = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeq((&NTI__6H5Oh5UUvVCLiakt9aTwtUQ_), 2); T2_->data[0] = ((NU8) 8); T2_->data[1] = ((NU8) 8); X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ((&query__A5Uv2n1VS9bfwvtTb9ahvZhw), T1_, T2_->data, (T2_ ? T2_->Sup.len : 0)); nimZeroMem((void*)T3_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T3_[0] = dollar___zMVAqVKur1IdGuBDQciPBg(query__A5Uv2n1VS9bfwvtTb9ahvZhw); echoBinSafe(T3_, 1); popFrame(); } } ```

Stats

  • Started 2023-12-18T11:53:27
  • Finished 2023-12-18T11:53:27
  • Duration
1.2.18 :+1: OK

Output

``` @[8, 8, 3] ```

IR

Compiled filesize 106.23 Kb (108,776 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # 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 tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ; 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_HSlice__EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA; typedef struct NimStringDesc NimStringDesc; struct TGenericSeq { NI len; NI reserved; }; 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; }; struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA { NI a; NI b; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ { TGenericSeq Sup; NU8 data[SEQ_DECL_SIZE]; }; 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); 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*, newSeqRC1)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(void, X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ** s, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA x, NU8* b, NI bLen_0); static N_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NOINLINE(void, chckNil)(void* p); N_LIB_PRIVATE N_NIMCALL(void*, newSeq)(TNimType* typ, NI len); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___zMVAqVKur1IdGuBDQciPBg)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); 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, NimMainModule)(void); extern TNimType NTI__6H5Oh5UUvVCLiakt9aTwtUQ_; N_LIB_PRIVATE tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* query__A5Uv2n1VS9bfwvtTb9ahvZhw; 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, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) { nimGCvisit((void*)query__A5Uv2n1VS9bfwvtTb9ahvZhw, 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_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b) { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA result; nimfr_("..", "/home/runner/.choosenim/toolchains/nim-1.2.18/lib/system.nim"); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); result.a = a; result.b = b; popFrame(); return result; } 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(); (*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); } { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA T1_; tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* T2_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); if (query__A5Uv2n1VS9bfwvtTb9ahvZhw) { nimGCunrefNoCycle(query__A5Uv2n1VS9bfwvtTb9ahvZhw); query__A5Uv2n1VS9bfwvtTb9ahvZhw = NIM_NIL; } query__A5Uv2n1VS9bfwvtTb9ahvZhw = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeqRC1((&NTI__6H5Oh5UUvVCLiakt9aTwtUQ_), 3); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[0] = ((NU8) 1); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[1] = ((NU8) 2); query__A5Uv2n1VS9bfwvtTb9ahvZhw->data[2] = ((NU8) 3); T1_ = dotdot___BokNSDrKN1xmV1nA01G9brAsystem(((NI) 0), ((NI) 1)); T2_ = NIM_NIL; T2_ = (tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*) newSeq((&NTI__6H5Oh5UUvVCLiakt9aTwtUQ_), 2); T2_->data[0] = ((NU8) 8); T2_->data[1] = ((NU8) 8); X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ((&query__A5Uv2n1VS9bfwvtTb9ahvZhw), T1_, T2_->data, (T2_ ? T2_->Sup.len : 0)); nimZeroMem((void*)T3_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T3_[0] = dollar___zMVAqVKur1IdGuBDQciPBg(query__A5Uv2n1VS9bfwvtTb9ahvZhw); echoBinSafe(T3_, 1); popFrame(); } } ```

Stats

  • Started 2023-12-18T11:53:30
  • Finished 2023-12-18T11:53:30
  • Duration
1.0.10 :+1: OK

Output

``` @[8, 8, 3] ```

IR

Compiled filesize 101.98 Kb (104,424 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # 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 tySequence__6H5Oh5UUvVCLiakt9aTwtUQ tySequence__6H5Oh5UUvVCLiakt9aTwtUQ; typedef struct TGenericSeq TGenericSeq; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA; typedef struct NimStringDesc NimStringDesc; struct TGenericSeq { NI len; NI reserved; }; 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_HSlice__EE5dzjqoOrHT6HJhIPXAvA { NI a; NI b; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; struct tySequence__6H5Oh5UUvVCLiakt9aTwtUQ { TGenericSeq Sup; NU8 data[SEQ_DECL_SIZE]; }; 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(void, genericSeqAssign)(void* dest, void* src, TNimType* mt); N_LIB_PRIVATE N_NIMCALL(void, X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ** s, tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA x, NU8* b, NI bLen_0); static N_INLINE(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_NOINLINE(void, chckNil)(void* p); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, dollar___zMVAqVKur1IdGuBDQciPBg)(tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* x); N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); 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, NimMainModule)(void); tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* query__A5Uv2n1VS9bfwvtTb9ahvZhw; extern TNimType NTI__6H5Oh5UUvVCLiakt9aTwtUQ_; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; NIM_CONST struct { TGenericSeq Sup; NU8 data[3]; } TM__SRd76hP9cMfCzdUO857UhQQ_4 = {{3, 3 | NIM_STRLIT_FLAG}, {((NU8) 1), ((NU8) 2), ((NU8) 3)}}; NIM_CONST tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* TM__SRd76hP9cMfCzdUO857UhQQ_3 = ((tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*)&TM__SRd76hP9cMfCzdUO857UhQQ_4); NIM_CONST struct { TGenericSeq Sup; NU8 data[2]; } TM__SRd76hP9cMfCzdUO857UhQQ_6 = {{2, 2 | NIM_STRLIT_FLAG}, {((NU8) 8), ((NU8) 8)}}; NIM_CONST tySequence__6H5Oh5UUvVCLiakt9aTwtUQ* TM__SRd76hP9cMfCzdUO857UhQQ_5 = ((tySequence__6H5Oh5UUvVCLiakt9aTwtUQ*)&TM__SRd76hP9cMfCzdUO857UhQQ_6); static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) { nimGCvisit((void*)query__A5Uv2n1VS9bfwvtTb9ahvZhw, 0); } 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_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(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA, dotdot___BokNSDrKN1xmV1nA01G9brAsystem)(NI a, NI b) { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA result; nimfr_("..", "/home/runner/.choosenim/toolchains/nim-1.0.10/lib/system.nim"); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); chckNil((void*)(&result)); nimZeroMem((void*)(&result), sizeof(tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA)); result.a = a; result.b = b; popFrame(); return result; } 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(); (*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) { { tyObject_HSlice__EE5dzjqoOrHT6HJhIPXAvA T1_; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2); genericSeqAssign((&query__A5Uv2n1VS9bfwvtTb9ahvZhw), TM__SRd76hP9cMfCzdUO857UhQQ_3, (&NTI__6H5Oh5UUvVCLiakt9aTwtUQ_)); T1_ = dotdot___BokNSDrKN1xmV1nA01G9brAsystem(((NI) 0), ((NI) 1)); X5BX5Deq___qJlVOFBL4jBLOAqY9cXVxDQ((&query__A5Uv2n1VS9bfwvtTb9ahvZhw), T1_, TM__SRd76hP9cMfCzdUO857UhQQ_5->data, (TM__SRd76hP9cMfCzdUO857UhQQ_5 ? TM__SRd76hP9cMfCzdUO857UhQQ_5->Sup.len : 0)); nimZeroMem((void*)T2_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T2_[0] = dollar___zMVAqVKur1IdGuBDQciPBg(query__A5Uv2n1VS9bfwvtTb9ahvZhw); echoBinSafe(T2_, 1); popFrame(); } } ```

Stats

  • Started 2023-12-18T11:53:32
  • Finished 2023-12-18T11:53:33
  • Duration
#919a889ba :arrow_right: :bug:

Diagnostics

metagn introduced a bug at 2022-09-28 22:28:45 +0300 on commit #919a889ba with message: ``` moderate system cleanup & refactor (#20355) * system refactor, move out 600 lines * compilation, slice, backwardsindex, misc_num moved out of system * some procs/types moved into arithmetics, basic_types * system no longer depends on syncio * some procs moved around to fit with their surroundings * make exceptions an import, old ops to misc_num * move instantiationInfo back * move back nim version, fix windows echo * include compilation * better docs for imported modules, fix unsigned ops also remove ze, ze64, toU8, toU16, toU32 with nimPreviewSlimSystem * fix terminal * workaround IC test & weird csize bug, changelog * move NimMajor etc back to compilation, rebase for CI * try ic fix * form single `indices`, slim out TaintedString, try fix IC * fix CI, update changelog, addQuitProc * fix CI * try fix CI * actually fix CI finally hopefully * Update lib/system/compilation.nim Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> * update kochdocs * hopefully fix csize uses for slimsystem * fix tquit Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> ``` The bug is in the files: ``` changelog.md compiler/lexer.nim compiler/renderer.nim doc/manual.md lib/core/typeinfo.nim lib/posix/posix_haiku.nim lib/posix/posix_nintendoswitch.nim lib/pure/memfiles.nim lib/pure/nativesockets.nim lib/pure/os.nim lib/pure/ssl_certs.nim lib/pure/terminal.nim lib/std/syncio.nim lib/system.nim lib/system/ansi_c.nim lib/system/arithmetics.nim lib/system/basic_types.nim lib/system/chcks.nim lib/system/comparisons.nim lib/system/compilation.nim lib/system/ctypes.nim lib/system/exceptions.nim lib/system/indices.nim lib/system/iterators.nim lib/system_overview.rst lib/windows/winlean.nim nimsuggest/tests/tsug_typedecl.nim nimsuggest/tests/ttype_decl.nim tests/cpp/tretvar.nim tests/misc/tradix.nim tests/misc/tunsignedconv.nim tests/misc/tvarnums.nim tests/range/trange.nim tests/stdlib/tquit.nim tests/stdlib/tstrset.nim tests/vm/tzero_extend.nim tools/kochdocs.nim ``` The bug can be in the commits: (Diagnostics sometimes off-by-one).
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 19.0
  • Created 2023-12-18T11:52:50Z
  • Comments 5
  • 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

:robot: Bug found in 53 minutes bisecting 1995 commits at 37 commits per second

metagn commented 1 week ago

The real culprit is #8817, for some reason it only triggered after #20355, possibly some symbol order ambiguity stuff. string has a specific overload for [] but seq has to use the unspecified magic overload, which it doesn't prefer over just converting to string.

A choice would be to add specific overloads for all of the types [] can index, seq, array, etc. See here. There are some complications, like pointer versions of these also support subscripts, i.e. (ptr ptr ref ptr string)[0] works, and tuples would need to be underspecified ((tuple, int): untyped). Also int is too specific for the index compared to what the compiler allows which is all int types, I don't know if this could cause issues with matching better/worse than user overloads.

Removing the overloads added in #8817 would break #8049 instead, the test for it has been changed to not be top level anymore which doesn't trigger the issue, so CI is misleading if this is attempted.