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

Unexpected seq copy under ORC #22552

Closed
nitely opened this issue Aug 25, 2023 · 7 comments
Closed

Unexpected seq copy under ORC #22552

nitely opened this issue Aug 25, 2023 · 7 comments

Comments

@nitely
Copy link
Contributor

nitely commented Aug 25, 2023

Description

I'm trying to reproduce a perf regression under ORC, where a seq copy causes an slowdown in nim-regex. The C code contains eqcopy___bug_u136((&colontmp__2), s_p0.s.p->data[i].next); when passing the seq, and it does not when passing the openArray. Almost certain this reproduces my issue.

type
  Node = object
    n: int
    next: seq[int]
    foobar: FooBar
  FooBar = object
    s: seq[Node]

proc `=copy`(dest: var Node; source: Node) {.error.}
proc `=copy`(dest: var FooBar; source: FooBar) {.error.}

proc doSomething(s: FooBar) =
  var ss: seq[int]
  for i in 0 .. s.s.len-1:
    #for j, elm in pairs toOpenArray(s.s[i].next, 0, s.s[i].next.len-1):
    for j, elm in pairs s.s[i].next:
      ss.add s.s[elm].n
  echo ss

when isMainModule:
  const foo = FooBar(s: @[Node(n: 1, next: @[0])])
  doSomething(foo)

Nim Version

$ nim -v
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-08-24
Copyright (c) 2006-2023 by Andreas Rumpf

git hash: 03f267c8013eca2830eb3deadda73ed08096ec12
active boot switches: -d:release

Current Output

No response

Expected Output

No response

Possible Solution

No response

Additional Information

No response

@Araq
Copy link
Member

Araq commented Aug 25, 2023

Looks like a system.pairs or iterator inling problem to me. Ping @ringabout please have a look.

@ringabout
Copy link
Member

What should I do? Make a cursor into the parameter?

@Araq
Copy link
Member

Araq commented Aug 25, 2023

Exactly.

@juancarlospaco
Copy link
Collaborator

!nim c --gc:orc

type
  Node = object
    n: int
    next: seq[int]
    foobar: FooBar
  FooBar = object
    s: seq[Node]

proc `=copy`(dest: var Node; source: Node) {.error.}
proc `=copy`(dest: var FooBar; source: FooBar) {.error.}

proc doSomething(s: FooBar) =
  var ss: seq[int]
  for i in 0 .. s.s.len-1:
    for j, elm in pairs s.s[i].next:
      ss.add s.s[elm].n
  echo ss

when isMainModule:
  const foo = FooBar(s: @[Node(n: 1, next: @[0])])
  doSomething(foo)
  doAssert off # To get the C in the bisects, check C code below.

@github-actions
Copy link
Contributor

@juancarlospaco (collaborator)

devel 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated]
/home/runner/work/Nim/Nim/temp.nim temp
/home/runner/.choosenim/toolchains/nim-#devel/lib/std/assertions.nim failedAssertImpl
/home/runner/.choosenim/toolchains/nim-#devel/lib/std/assertions.nim raiseAssert
/home/runner/.choosenim/toolchains/nim-#devel/lib/system/fatal.nim sysFatal
Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(19, 3) `off`  [AssertionDefect]
Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp'

Stats

  • Started 2023-08-25T12:38:24
  • Finished 2023-08-25T12:38:25
  • Duration

IR

Compiled filesize 108.03 Kb (110,624 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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 tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw tySequence__eAmRiDarZZlUbM8h9aWY9a9cw;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q;
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw {
  NI len; tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content* p;
};
struct tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA {
	tySequence__eAmRiDarZZlUbM8h9aWY9a9cw s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q {
	NI n;
	tySequence__qwqHTkRvwhrRyENtudHQ7g next;
	tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content { NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[SEQ_DECL_SIZE]; };
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___temp_u140)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest_p0, tySequence__qwqHTkRvwhrRyENtudHQ7g src_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(void, add__temp_u50)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x_p0, NI y_p1);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u137)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u271)(tySequence__qwqHTkRvwhrRyENtudHQ7g x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4967)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(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[147+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 147 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-#devel/lib/system/iterators.nim(179, 11) `len(a) == L` the length of the seq changed while iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {147, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI)0)}};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI)1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
static const struct {
  NI cap; NIM_CHAR data[48+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 48 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 3) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {48, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foo__temp_u320 = {{1, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4751;
extern NIM_THREADVAR TFrame* framePtr__system_u4375;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__system_u4751);
	return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
	{
		if (!(framePtr__system_u4375 == ((TFrame*) NIM_NIL))) goto LA3_;
		(*s_p0).calldepth = ((NI16)0);
	}
	goto LA1_;
LA3_: ;
	{
		(*s_p0).calldepth = (NI16)((*framePtr__system_u4375).calldepth + ((NI16)1));
	}
LA1_: ;
	(*s_p0).prev = framePtr__system_u4375;
	framePtr__system_u4375 = s_p0;
	{
		if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
		callDepthLimitReached__system_u4967();
	}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__system_u4375 = (*framePtr__system_u4375).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s_p0.s.len;
		if (nimSubInt(T3_, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
		};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI)0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if (i < 0 || i >= s_p0.s.len){ raiseIndexError2(i,s_p0.s.len-1); goto LA1_;
					}
					eqcopy___temp_u140((&colontmp__2), s_p0.s.p->data[i].next);
					i_2 = ((NI)0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if (i_2 < 0 || i_2 >= colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
							}
							elm = colontmp__2.p->data[i_2];
							if (elm < 0 || elm >= s_p0.s.len){ raiseIndexError2(elm,s_p0.s.len-1); goto LA1_;
							}
							colontmpD__2 = s_p0.s.p->data[elm].n;
							add__temp_u50((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
							};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
LA13_: ;
						} LA9: ;
					}
					eqdestroy___temp_u137(colontmp__2);
				}
				if (nimAddInt(res, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
				};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___temp_u271(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
		eqdestroy___temp_u137(ss);
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__temp_u13(foo__temp_u320);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
stable 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated]
/home/runner/work/Nim/Nim/temp.nim temp
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/std/assertions.nim failedAssertImpl
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/std/assertions.nim raiseAssert
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/fatal.nim sysFatal
Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(19, 3) `off`  [AssertionDefect]
Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp'

Stats

  • Started 2023-08-25T12:38:25
  • Finished 2023-08-25T12:38:26
  • Duration

IR

Compiled filesize 105.86 Kb (108,400 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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 tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw tySequence__eAmRiDarZZlUbM8h9aWY9a9cw;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q;
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw {
  NI len; tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content* p;
};
struct tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA {
	tySequence__eAmRiDarZZlUbM8h9aWY9a9cw s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q {
	NI n;
	tySequence__qwqHTkRvwhrRyENtudHQ7g next;
	tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content { NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[SEQ_DECL_SIZE]; };
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___temp_u142)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest_p0, tySequence__qwqHTkRvwhrRyENtudHQ7g src_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(void, add__temp_u51)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x_p0, NI y_p1);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u139)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u273)(tySequence__qwqHTkRvwhrRyENtudHQ7g x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5021)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(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[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/iterators.nim(179, 11) `len(a) == L` the length of the seq changed while iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI)0)}};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI)1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
static const struct {
  NI cap; NIM_CHAR data[48+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 48 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 3) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {48, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foo__temp_u323 = {{1, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4803;
extern NIM_THREADVAR TFrame* framePtr__system_u4420;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__system_u4803);
	return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
	{
		if (!(framePtr__system_u4420 == ((TFrame*) NIM_NIL))) goto LA3_;
		(*s_p0).calldepth = ((NI16)0);
	}
	goto LA1_;
LA3_: ;
	{
		(*s_p0).calldepth = (NI16)((*framePtr__system_u4420).calldepth + ((NI16)1));
	}
LA1_: ;
	(*s_p0).prev = framePtr__system_u4420;
	framePtr__system_u4420 = s_p0;
	{
		if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
		callDepthLimitReached__system_u5021();
	}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__system_u4420 = (*framePtr__system_u4420).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s_p0.s.len;
		if (nimSubInt(T3_, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
		};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI)0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if (i < 0 || i >= s_p0.s.len){ raiseIndexError2(i,s_p0.s.len-1); goto LA1_;
					}
					eqcopy___temp_u142((&colontmp__2), s_p0.s.p->data[i].next);
					i_2 = ((NI)0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if (i_2 < 0 || i_2 >= colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
							}
							elm = colontmp__2.p->data[i_2];
							if (elm < 0 || elm >= s_p0.s.len){ raiseIndexError2(elm,s_p0.s.len-1); goto LA1_;
							}
							colontmpD__2 = s_p0.s.p->data[elm].n;
							add__temp_u51((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
							};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
LA13_: ;
						} LA9: ;
					}
					eqdestroy___temp_u139(colontmp__2);
				}
				if (nimAddInt(res, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
				};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___temp_u273(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
		eqdestroy___temp_u139(ss);
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__temp_u13(foo__temp_u323);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
2.0.0 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated]
/home/runner/work/Nim/Nim/temp.nim temp
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/std/assertions.nim failedAssertImpl
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/std/assertions.nim raiseAssert
/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/fatal.nim sysFatal
Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(19, 3) `off`  [AssertionDefect]
Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp'

Stats

  • Started 2023-08-25T12:38:26
  • Finished 2023-08-25T12:38:27
  • Duration

IR

Compiled filesize 105.86 Kb (108,400 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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 tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw tySequence__eAmRiDarZZlUbM8h9aWY9a9cw;
typedef struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q;
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw {
  NI len; tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content* p;
};
struct tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA {
	tySequence__eAmRiDarZZlUbM8h9aWY9a9cw s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
	NI cap;
	NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
	NI len;
	NimStrPayload* p;
};
struct tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q {
	NI n;
	tySequence__qwqHTkRvwhrRyENtudHQ7g next;
	tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
struct tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content { NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[SEQ_DECL_SIZE]; };
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE]; };
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___temp_u142)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest_p0, tySequence__qwqHTkRvwhrRyENtudHQ7g src_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NIMCALL(void, add__temp_u51)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x_p0, NI y_p1);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u139)(tySequence__qwqHTkRvwhrRyENtudHQ7g dest_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u273)(tySequence__qwqHTkRvwhrRyENtudHQ7g x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5021)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(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[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/iterators.nim(179, 11) `len(a) == L` the length of the seq changed while iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI)0)}};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG};
static const struct {
  NI cap; tyObject_Node__4y74XJEHW9cbjE9cq5Lf2F2Q data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI)1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
static const struct {
  NI cap; NIM_CHAR data[48+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 48 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 3) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {48, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA foo__temp_u323 = {{1, (tySequence__eAmRiDarZZlUbM8h9aWY9a9cw_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4803;
extern NIM_THREADVAR TFrame* framePtr__system_u4420;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__system_u4803);
	return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
	{
		if (!(framePtr__system_u4420 == ((TFrame*) NIM_NIL))) goto LA3_;
		(*s_p0).calldepth = ((NI16)0);
	}
	goto LA1_;
LA3_: ;
	{
		(*s_p0).calldepth = (NI16)((*framePtr__system_u4420).calldepth + ((NI16)1));
	}
LA1_: ;
	(*s_p0).prev = framePtr__system_u4420;
	framePtr__system_u4420 = s_p0;
	{
		if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
		callDepthLimitReached__system_u5021();
	}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__system_u4420 = (*framePtr__system_u4420).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__temp_u13)(tyObject_FooBar__b7qfaFaTSaBLNuTEsyVKtA s_p0) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s_p0.s.len;
		if (nimSubInt(T3_, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
		};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI)0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if (i < 0 || i >= s_p0.s.len){ raiseIndexError2(i,s_p0.s.len-1); goto LA1_;
					}
					eqcopy___temp_u142((&colontmp__2), s_p0.s.p->data[i].next);
					i_2 = ((NI)0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if (i_2 < 0 || i_2 >= colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
							}
							elm = colontmp__2.p->data[i_2];
							if (elm < 0 || elm >= s_p0.s.len){ raiseIndexError2(elm,s_p0.s.len-1); goto LA1_;
							}
							colontmpD__2 = s_p0.s.p->data[elm].n;
							add__temp_u51((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
							};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
LA13_: ;
						} LA9: ;
					}
					eqdestroy___temp_u139(colontmp__2);
				}
				if (nimAddInt(res, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
				};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___temp_u273(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
 deallocShared(colontmpD_.p);
}
		eqdestroy___temp_u139(ss);
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__temp_u13(foo__temp_u323);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
1.6.0 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings: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 temp
/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/assertions.nim failedAssertImpl
/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/assertions.nim raiseAssert
/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/fatal.nim sysFatal
Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(19, 12) `off`  [AssertionDefect]
Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp '

Stats

  • Started 2023-08-25T12:38:30
  • Finished 2023-08-25T12:38:30
  • Duration

IR

Compiled filesize 108.43 Kb (111,032 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
  #  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_FooBar__0M79bwGSevolN5nOg1d04bQ tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA tySequence__xNpO9a10FkwW5W3qzxr2JwA;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA;
typedef struct tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q;
typedef struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg;
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA {
  NI len; tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content* p;
};
struct tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ {
tySequence__xNpO9a10FkwW5W3qzxr2JwA s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA {
NI len;
tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q* p;
};
struct tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q {
NI cap;
NI data[SEQ_DECL_SIZE];
};
struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg {
NI n;
tySequence__qwqHTkRvwhrRyENtudHQ7g next;
tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
#ifndef tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
#define tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content { NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
      N_LIB_PRIVATE N_NIMCALL(void, doSomething_temp_13)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy__temp_166)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src);
N_LIB_PRIVATE N_NIMCALL(void, setLen_temp_179)(tySequence__qwqHTkRvwhrRyENtudHQ7g* s, NI newlen);
N_LIB_PRIVATE N_NIMCALL(void, shrink_temp_186)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI newLen);
N_LIB_PRIVATE N_NIMCALL(void*, prepareSeqAdd)(NI len, void* p, NI addlen, NI elemSize, NI elemAlign);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(void, add_temp_50)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl_systemZassertions_62)(NimStringV2 msg);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_163)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest);
N_LIB_PRIVATE N_NIMCALL(void, alignedDealloc)(void* p, NI align);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar__temp_218)(tySequence__qwqHTkRvwhrRyENtudHQ7g x);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, collectionToString_temp_222)(tySequence__qwqHTkRvwhrRyENtudHQ7g x, NimStringV2 prefix, NimStringV2 separator, NimStringV2 suffix);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy__system_3614)(NimStringV2* dest, NimStringV2 src);
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src);
static N_INLINE(void, copyMem_system_1709)(void* dest, void* source, NI size);
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size);
N_LIB_PRIVATE N_NOINLINE(void, raiseRangeErrorI)(NI64 i, NI64 a, NI64 b);
N_LIB_PRIVATE N_NIMCALL(void, prepareAdd)(NimStringV2* s, NI addlen);
N_LIB_PRIVATE N_NIMCALL(void, addQuoted_temp_254)(NimStringV2* s, NI x);
static N_INLINE(void, addInt_stdZprivateZdigitsutils_196)(NimStringV2* result, NI x);
N_LIB_PRIVATE N_NIMCALL(void, addInt_stdZprivateZdigitsutils_174)(NimStringV2* result, NI64 x);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached_system_4760)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__system_3611)(NimStringV2* dest);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/iterators.nim(173, 11) `len(a) == L` the length of the seq changed while iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_8 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_7};
static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_12 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/iterators.nim(240, 11) `len(a) == L` the length of the seq changed while iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_13 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_12};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_14 = { 2 | NIM_STRLIT_FLAG, "@[" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_15 = {2, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_14};
static const struct {
  NI cap; NIM_CHAR data[2+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_16 = { 2 | NIM_STRLIT_FLAG, ", " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_17 = {2, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_16};
static const struct {
  NI cap; NIM_CHAR data[1+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_18 = { 1 | NIM_STRLIT_FLAG, "]" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_19 = {1, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_18};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_20 = {1 | NIM_STRLIT_FLAG, {((NI) 0)}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_21 = {0 | NIM_STRLIT_FLAG, {}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_22 = {1 | NIM_STRLIT_FLAG, {{((NI) 1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_20}, {{0, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_21}}
}
}};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foo_temp_267 = {{1, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_22}}
;
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_23 = { 49 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 12) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_24 = {49, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_23};
extern NIM_BOOL nimInErrorMode_system_4593;
extern TFrame* framePtr_system_4242;
extern TFrame* framePtr_system_4242;
extern TFrame* framePtr_system_4242;
extern TFrame* framePtr_system_4242;
extern TFrame* framePtr_system_4242;
extern TFrame* framePtr_system_4242;
N_LIB_PRIVATE N_NIMCALL(void, shrink_temp_186)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI newLen) {
	(*((tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA*) (x))).len = ((NI) (newLen));
}
N_LIB_PRIVATE N_NIMCALL(void, setLen_temp_179)(tySequence__qwqHTkRvwhrRyENtudHQ7g* s, NI newlen) {
{	{
		NI T3_;
		T3_ = (*s).len;
		if (!(((NI) (newlen)) < T3_)) goto LA4_;
		shrink_temp_186(s, newlen);
	}
	goto LA1_;
	LA4_: ;
	{
		NI oldLen;
		NI T7_;
		tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA* xu;
		T7_ = (*s).len;
		oldLen = T7_;
		{
			if (!(((NI) (newlen)) <= oldLen)) goto LA10_;
			goto BeforeRet_;
		}
		LA10_: ;
		xu = ((tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA*) (s));
		{
			NIM_BOOL T14_;
			NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
			void* T18_;
			T14_ = (NIM_BOOL)0;
			T14_ = ((*xu).p == ((tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q*) NIM_NIL));
			if (T14_) goto LA15_;
			T14_ = ((*(*xu).p).cap < ((NI) (newlen)));
			LA15_: ;
			if (!T14_) goto LA16_;
			if (nimSubInt(((NI) (newlen)), oldLen, &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
};
			T18_ = (void*)0;
			T18_ = prepareSeqAdd(oldLen, ((void*) ((*xu).p)), (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3), ((NI) 8), ((NI) 8));
			(*xu).p = ((tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q*) (T18_));
		}
		LA16_: ;
		(*xu).len = ((NI) (newlen));
	}
	LA1_: ;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqcopy__temp_166)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src) {
	NI T1_;
	NI colontmp_;
	T1_ = src.len;
	setLen_temp_179((&(*dest)), T1_);
	colontmp_ = ((NI) 0);
	{
		while (1) {
			NI T4_;
			T4_ = (*dest).len;
			if (!(colontmp_ < T4_)) goto LA3;
			(*dest).p->data[colontmp_] = src.p->data[colontmp_];
			colontmp_ += ((NI) 1);
		} LA3: ;
	}
}
N_LIB_PRIVATE N_NIMCALL(void, add_temp_50)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value) {
	NI oldLen;
	NI T1_;
	tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA* xu;
	NI TM__SRd76hP9cMfCzdUO857UhQQ_5;
{	T1_ = (*x).len;
	oldLen = T1_;
	xu = ((tyObject_NimSeqV2__Q27im4NvCIX735oBXfroyA*) (x));
	{
		NIM_BOOL T4_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
		void* T8_;
		T4_ = (NIM_BOOL)0;
		T4_ = ((*xu).p == ((tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q*) NIM_NIL));
		if (T4_) goto LA5_;
		if (nimAddInt(oldLen, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
		T4_ = ((*(*xu).p).cap < (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4));
		LA5_: ;
		if (!T4_) goto LA6_;
		T8_ = (void*)0;
		T8_ = prepareSeqAdd(oldLen, ((void*) ((*xu).p)), ((NI) 1), ((NI) 8), ((NI) 8));
		(*xu).p = ((tyObject_NimSeqPayload__hKmcfrIyKucBh7ADIUKy1Q*) (T8_));
	}
	LA6_: ;
	if (nimAddInt(oldLen, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_5)) { raiseOverflow(); goto BeforeRet_;
};
	(*xu).len = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_5);
	(*(*xu).p).data[oldLen] = value;
	}BeforeRet_: ;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy__temp_163)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest) {
	if ((*dest).p && !((*dest).p->cap & NIM_STRLIT_FLAG)) {
 alignedDealloc((*dest).p, NIM_ALIGNOF(NI));
}
}
static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) {
	void* T1_;
	T1_ = (void*)0;
	T1_ = memcpy(dest, source, ((size_t) (size)));
}
static N_INLINE(void, copyMem_system_1709)(void* dest, void* source, NI size) {
	nimCopyMem(dest, source, size);
}
static N_INLINE(void, appendString)(NimStringV2* dest, NimStringV2 src) {
{	{
		NI TM__SRd76hP9cMfCzdUO857UhQQ_10;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_11;
		if (!(((NI) 0) < src.len)) goto LA3_;
		if (nimAddInt(src.len, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_10)) { raiseOverflow(); goto BeforeRet_;
};
		if (((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_10)) < ((NI) 0) || ((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_10)) > ((NI) IL64(9223372036854775807))){ raiseRangeErrorI((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_10), ((NI) 0), ((NI) IL64(9223372036854775807))); goto BeforeRet_;
}
		copyMem_system_1709(((void*) ((&(*(*dest).p).data[(*dest).len]))), ((void*) ((&(*src.p).data[((NI) 0)]))), ((NI) ((NI)(TM__SRd76hP9cMfCzdUO857UhQQ_10))));
		if (nimAddInt((*dest).len, src.len, &TM__SRd76hP9cMfCzdUO857UhQQ_11)) { raiseOverflow(); goto BeforeRet_;
};
		(*dest).len = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_11);
	}
	LA3_: ;
	}BeforeRet_: ;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode_system_4593);
	return result;
}
static N_INLINE(void, nimFrame)(TFrame* s) {
	{
		if (!(framePtr_system_4242 == ((TFrame*) NIM_NIL))) goto LA3_;
		(*s).calldepth = ((NI16) 0);
	}
	goto LA1_;
	LA3_: ;
	{
		(*s).calldepth = (NI16)((*framePtr_system_4242).calldepth + ((NI16) 1));
	}
	LA1_: ;
	(*s).prev = framePtr_system_4242;
	framePtr_system_4242 = s;
	{
		if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
		callDepthLimitReached_system_4760();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr_system_4242 = (*framePtr_system_4242).prev;
}
static N_INLINE(void, addInt_stdZprivateZdigitsutils_196)(NimStringV2* result, NI x) {
NIM_BOOL* nimErr_;
	nimfr_("addInt", "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/std/private/digitsutils.nim");
{nimErr_ = nimErrorFlag();
	addInt_stdZprivateZdigitsutils_174(result, ((NI64) (x)));
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, addQuoted_temp_254)(NimStringV2* s, NI x) {
NIM_BOOL* nimErr_;
	nimfr_("addQuoted", "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system.nim");
{nimErr_ = nimErrorFlag();
	addInt_stdZprivateZdigitsutils_196(s, x);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, collectionToString_temp_222)(tySequence__qwqHTkRvwhrRyENtudHQ7g x, NimStringV2 prefix, NimStringV2 separator, NimStringV2 suffix) {
	NimStringV2 result;
	NIM_BOOL firstElement;
NIM_BOOL* nimErr_;
	nimfr_("collectionToString", "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/dollars.nim");
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	eqcopy__system_3614((&result), prefix);
	firstElement = NIM_TRUE;
	{
		NI* value;
		NI i;
		NI L;
		NI T2_;
		value = (NI*)0;
		i = ((NI) 0);
		T2_ = x.len;
		L = T2_;
		{
			while (1) {
				if (!(i < L)) goto LA4;
				value = (&x.p->data[i]);
				{
					if (!firstElement) goto LA7_;
					firstElement = NIM_FALSE;
				}
				goto LA5_;
				LA7_: ;
				{
					prepareAdd((&result), separator.len + 0);
appendString((&result), separator);
				}
				LA5_: ;
				addQuoted_temp_254((&result), (*value));
				i += ((NI) 1);
				{
					NI T12_;
					T12_ = x.len;
					if (!!((T12_ == L))) goto LA13_;
					failedAssertImpl_systemZassertions_62(TM__SRd76hP9cMfCzdUO857UhQQ_13);
					if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
				}
				LA13_: ;
			} LA4: ;
		}
	}
	prepareAdd((&result), suffix.len + 0);
appendString((&result), suffix);
	}BeforeRet_: ;
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar__temp_218)(tySequence__qwqHTkRvwhrRyENtudHQ7g x) {
	NimStringV2 result;
NIM_BOOL* nimErr_;
	nimfr_("$", "/home/runner/.choosenim/toolchains/nim-1.6.0/lib/system/dollars.nim");
{nimErr_ = nimErrorFlag();
	result.len = 0; result.p = NIM_NIL;
	result = collectionToString_temp_222(x, TM__SRd76hP9cMfCzdUO857UhQQ_15, TM__SRd76hP9cMfCzdUO857UhQQ_17, TM__SRd76hP9cMfCzdUO857UhQQ_19);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
	return result;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething_temp_13)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s.s.len;
		if (nimSubInt(T3_, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI) 0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_9;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if ((NU)(i) >= (NU)s.s.len){ raiseIndexError2(i,s.s.len-1); goto LA1_;
}
					eqcopy__temp_166((&colontmp__2), s.s.p->data[i].next);
					i_2 = ((NI) 0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if ((NU)(i_2) >= (NU)colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
}
							elm = colontmp__2.p->data[i_2];
							if ((NU)(elm) >= (NU)s.s.len){ raiseIndexError2(elm,s.s.len-1); goto LA1_;
}
							colontmpD__2 = s.s.p->data[elm].n;
							add_temp_50((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl_systemZassertions_62(TM__SRd76hP9cMfCzdUO857UhQQ_8);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
							LA13_: ;
						} LA9: ;
					}
					eqdestroy__temp_163((&colontmp__2));
				}
				if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_9)) { raiseOverflow(); goto LA1_;
};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_9);
			} LA5: ;
		}
	}
	colontmpD_ = dollar__temp_218(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		eqdestroy__system_3611((&colontmpD_));
		eqdestroy__temp_163((&ss));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
	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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething_temp_13(foo_temp_267);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl_systemZassertions_62(TM__SRd76hP9cMfCzdUO857UhQQ_24);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
1.4.0 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings: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 temp
/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/assertions.nim failedAssertImpl
/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/assertions.nim raiseAssert
/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/fatal.nim sysFatal
Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(19, 12) `off`  [AssertionDefect]
Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp '

Stats

  • Started 2023-08-25T12:38:33
  • Finished 2023-08-25T12:38:34
  • Duration

IR

Compiled filesize 98.03 Kb (100,384 bytes)
#define NIM_INTBITS 64

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

  #  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_FooBar__0M79bwGSevolN5nOg1d04bQ tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA tySequence__xNpO9a10FkwW5W3qzxr2JwA;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg;

struct tySequence__xNpO9a10FkwW5W3qzxr2JwA {
  NI len; tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content* p;
};
struct tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ {
tySequence__xNpO9a10FkwW5W3qzxr2JwA s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg {
NI n;
tySequence__qwqHTkRvwhrRyENtudHQ7g next;
tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
#ifndef tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
#define tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content { NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif

N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___voJ1IJTPQdxEklrxxh17Ew)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(void, add__MIAbjRZGBQlNfywJeCn8AQ)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringV2 msg);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___2FaMhgTYqczm61zqlScqSg)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___Gsa4WPnABj84BVdJHxUK1w)(tySequence__qwqHTkRvwhrRyENtudHQ7g x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
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(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);

static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/iterato"
"rs.nim(137, 11) `len(a) == L` the length of the seq changed whil"
"e iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI) 0)}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG, {}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI) 1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foo__D3je05E39cIF7fHazGtqROg = {{1, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 49 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 12) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {49, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};

extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;

static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
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) 2000))) goto LA8_;
		callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s.s.len;
		if (nimSubInt(T3_, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI) 0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if ((NU)(i) >= (NU)s.s.len){ raiseIndexError2(i,s.s.len-1); goto LA1_;
}
					eqcopy___voJ1IJTPQdxEklrxxh17Ew((&colontmp__2), s.s.p->data[i].next);
					i_2 = ((NI) 0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if ((NU)(i_2) >= (NU)colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
}
							elm = colontmp__2.p->data[i_2];
							if ((NU)(elm) >= (NU)s.s.len){ raiseIndexError2(elm,s.s.len-1); goto LA1_;
}
							colontmpD__2 = s.s.p->data[elm].n;
							add__MIAbjRZGBQlNfywJeCn8AQ((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
							LA13_: ;
						} LA9: ;
					}
					eqdestroy___2FaMhgTYqczm61zqlScqSg((&colontmp__2));
				}
				if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___Gsa4WPnABj84BVdJHxUK1w(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&colontmpD_));
		eqdestroy___2FaMhgTYqczm61zqlScqSg((&ss));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
	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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__UfHtkKYoEZKt9aI70lEbS0g(foo__D3je05E39cIF7fHazGtqROg);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
1.2.0 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Stats

  • Started 2023-08-25T12:38:49
  • Finished 2023-08-25T12:38:49
  • Duration

IR

Compiled filesize 98.03 Kb (100,384 bytes)
#define NIM_INTBITS 64

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

  #  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_FooBar__0M79bwGSevolN5nOg1d04bQ tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA tySequence__xNpO9a10FkwW5W3qzxr2JwA;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg;

struct tySequence__xNpO9a10FkwW5W3qzxr2JwA {
  NI len; tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content* p;
};
struct tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ {
tySequence__xNpO9a10FkwW5W3qzxr2JwA s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg {
NI n;
tySequence__qwqHTkRvwhrRyENtudHQ7g next;
tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
#ifndef tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
#define tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content { NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif

N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___voJ1IJTPQdxEklrxxh17Ew)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(void, add__MIAbjRZGBQlNfywJeCn8AQ)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringV2 msg);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___2FaMhgTYqczm61zqlScqSg)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___Gsa4WPnABj84BVdJHxUK1w)(tySequence__qwqHTkRvwhrRyENtudHQ7g x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
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(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);

static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/iterato"
"rs.nim(137, 11) `len(a) == L` the length of the seq changed whil"
"e iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI) 0)}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG, {}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI) 1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foo__D3je05E39cIF7fHazGtqROg = {{1, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 49 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 12) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {49, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};

extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;

static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
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) 2000))) goto LA8_;
		callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s.s.len;
		if (nimSubInt(T3_, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI) 0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if ((NU)(i) >= (NU)s.s.len){ raiseIndexError2(i,s.s.len-1); goto LA1_;
}
					eqcopy___voJ1IJTPQdxEklrxxh17Ew((&colontmp__2), s.s.p->data[i].next);
					i_2 = ((NI) 0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if ((NU)(i_2) >= (NU)colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
}
							elm = colontmp__2.p->data[i_2];
							if ((NU)(elm) >= (NU)s.s.len){ raiseIndexError2(elm,s.s.len-1); goto LA1_;
}
							colontmpD__2 = s.s.p->data[elm].n;
							add__MIAbjRZGBQlNfywJeCn8AQ((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
							LA13_: ;
						} LA9: ;
					}
					eqdestroy___2FaMhgTYqczm61zqlScqSg((&colontmp__2));
				}
				if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___Gsa4WPnABj84BVdJHxUK1w(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&colontmpD_));
		eqdestroy___2FaMhgTYqczm61zqlScqSg((&ss));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
	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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__UfHtkKYoEZKt9aI70lEbS0g(foo__D3je05E39cIF7fHazGtqROg);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
1.0.0 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'orc' found

Stats

  • Started 2023-08-25T12:39:00
  • Finished 2023-08-25T12:39:00
  • Duration

IR

Compiled filesize 98.03 Kb (100,384 bytes)
#define NIM_INTBITS 64

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

  #  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_FooBar__0M79bwGSevolN5nOg1d04bQ tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA tySequence__xNpO9a10FkwW5W3qzxr2JwA;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg;

struct tySequence__xNpO9a10FkwW5W3qzxr2JwA {
  NI len; tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content* p;
};
struct tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ {
tySequence__xNpO9a10FkwW5W3qzxr2JwA s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg {
NI n;
tySequence__qwqHTkRvwhrRyENtudHQ7g next;
tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
#ifndef tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
#define tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content { NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif

N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___voJ1IJTPQdxEklrxxh17Ew)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(void, add__MIAbjRZGBQlNfywJeCn8AQ)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringV2 msg);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___2FaMhgTYqczm61zqlScqSg)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___Gsa4WPnABj84BVdJHxUK1w)(tySequence__qwqHTkRvwhrRyENtudHQ7g x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
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(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);

static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/iterato"
"rs.nim(137, 11) `len(a) == L` the length of the seq changed whil"
"e iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI) 0)}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG, {}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI) 1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foo__D3je05E39cIF7fHazGtqROg = {{1, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 49 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 12) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {49, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};

extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;

static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
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) 2000))) goto LA8_;
		callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s.s.len;
		if (nimSubInt(T3_, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI) 0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if ((NU)(i) >= (NU)s.s.len){ raiseIndexError2(i,s.s.len-1); goto LA1_;
}
					eqcopy___voJ1IJTPQdxEklrxxh17Ew((&colontmp__2), s.s.p->data[i].next);
					i_2 = ((NI) 0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if ((NU)(i_2) >= (NU)colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
}
							elm = colontmp__2.p->data[i_2];
							if ((NU)(elm) >= (NU)s.s.len){ raiseIndexError2(elm,s.s.len-1); goto LA1_;
}
							colontmpD__2 = s.s.p->data[elm].n;
							add__MIAbjRZGBQlNfywJeCn8AQ((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
							LA13_: ;
						} LA9: ;
					}
					eqdestroy___2FaMhgTYqczm61zqlScqSg((&colontmp__2));
				}
				if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___Gsa4WPnABj84BVdJHxUK1w(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&colontmpD_));
		eqdestroy___2FaMhgTYqczm61zqlScqSg((&ss));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
	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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__UfHtkKYoEZKt9aI70lEbS0g(foo__D3je05E39cIF7fHazGtqROg);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
0.20.2 👎 FAIL

Output

Error: Command failed: nim c --gc:orc -d:nimArcDebug -d:nimArcIds  --run  -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'orc' found

Stats

  • Started 2023-08-25T12:39:11
  • Finished 2023-08-25T12:39:11
  • Duration

IR

Compiled filesize 98.03 Kb (100,384 bytes)
#define NIM_INTBITS 64

#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix

  #  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_FooBar__0M79bwGSevolN5nOg1d04bQ tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA tySequence__xNpO9a10FkwW5W3qzxr2JwA;
typedef struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g tySequence__qwqHTkRvwhrRyENtudHQ7g;
typedef struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content tySequence__qwqHTkRvwhrRyENtudHQ7g_Content;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg;

struct tySequence__xNpO9a10FkwW5W3qzxr2JwA {
  NI len; tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content* p;
};
struct tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ {
tySequence__xNpO9a10FkwW5W3qzxr2JwA s;
};
struct tySequence__qwqHTkRvwhrRyENtudHQ7g {
  NI len; tySequence__qwqHTkRvwhrRyENtudHQ7g_Content* p;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
struct tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg {
NI n;
tySequence__qwqHTkRvwhrRyENtudHQ7g next;
tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foobar;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
#ifndef tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
#define tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content_PP
struct tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content { NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif
#ifndef tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
#define tySequence__qwqHTkRvwhrRyENtudHQ7g_Content_PP
struct tySequence__qwqHTkRvwhrRyENtudHQ7g_Content { NI cap; NI data[SEQ_DECL_SIZE];};
#endif

N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqcopy___voJ1IJTPQdxEklrxxh17Ew)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest, tySequence__qwqHTkRvwhrRyENtudHQ7g src);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NIMCALL(void, add__MIAbjRZGBQlNfywJeCn8AQ)(tySequence__qwqHTkRvwhrRyENtudHQ7g* x, NI value);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringV2 msg);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___2FaMhgTYqczm61zqlScqSg)(tySequence__qwqHTkRvwhrRyENtudHQ7g* dest);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___Gsa4WPnABj84BVdJHxUK1w)(tySequence__qwqHTkRvwhrRyENtudHQ7g x);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args, NI argsLen_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(NimStringV2* dest);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
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(void, nimTestErrorFlag)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);

static const struct {
  NI cap; NIM_CHAR data[146+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 146 | NIM_STRLIT_FLAG, "/home/runner/.choosenim/toolchains/nim-1.4.0/lib/system/iterato"
"rs.nim(137, 11) `len(a) == L` the length of the seq changed whil"
"e iterating over it" };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_5 = {146, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_4};
static const struct {
  NI cap; NI data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_7 = {1 | NIM_STRLIT_FLAG, {((NI) 0)}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[0];
} TM__SRd76hP9cMfCzdUO857UhQQ_8 = {0 | NIM_STRLIT_FLAG, {}};
static const struct {
  NI cap; tyObject_Node__9bYKAj7SLef9ce6Qu6EqKHYg data[1];
} TM__SRd76hP9cMfCzdUO857UhQQ_9 = {1 | NIM_STRLIT_FLAG, {{((NI) 1), {1, (tySequence__qwqHTkRvwhrRyENtudHQ7g_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}, {{0, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_8}}
}
}};
N_LIB_PRIVATE NIM_CONST tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ foo__D3je05E39cIF7fHazGtqROg = {{1, (tySequence__xNpO9a10FkwW5W3qzxr2JwA_Content*)&TM__SRd76hP9cMfCzdUO857UhQQ_9}}
;
static const struct {
  NI cap; NIM_CHAR data[49+1];
} TM__SRd76hP9cMfCzdUO857UhQQ_10 = { 49 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(19, 12) `off` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_11 = {49, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_10};

extern NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;

static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
	NIM_BOOL* result;
	result = (NIM_BOOL*)0;
	result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA);
	return result;
}
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) 2000))) goto LA8_;
		callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
	}
	LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
	framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, doSomething__UfHtkKYoEZKt9aI70lEbS0g)(tyObject_FooBar__0M79bwGSevolN5nOg1d04bQ s) {
	tySequence__qwqHTkRvwhrRyENtudHQ7g ss;
	NimStringV2 colontmpD_;
	tyArray__nHXaesL0DJZHyVS07ARPRA T15_;
NIM_BOOL* nimErr_;
	nimfr_("doSomething", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
	ss.len = 0; ss.p = NIM_NIL;
	colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
	{
		NI i;
		NI colontmp_;
		NI T3_;
		NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
		NI res;
		i = (NI)0;
		colontmp_ = (NI)0;
		T3_ = s.s.len;
		if (nimSubInt(T3_, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto LA1_;
};
		colontmp_ = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
		res = ((NI) 0);
		{
			while (1) {
				NI TM__SRd76hP9cMfCzdUO857UhQQ_6;
				if (!(res <= colontmp_)) goto LA5;
				i = res;
				{
					tySequence__qwqHTkRvwhrRyENtudHQ7g colontmp__2;
					NI j;
					NI elm;
					NI i_2;
					NI L;
					NI T7_;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					j = (NI)0;
					elm = (NI)0;
					colontmp__2.len = 0; colontmp__2.p = NIM_NIL;
					if ((NU)(i) >= (NU)s.s.len){ raiseIndexError2(i,s.s.len-1); goto LA1_;
}
					eqcopy___voJ1IJTPQdxEklrxxh17Ew((&colontmp__2), s.s.p->data[i].next);
					i_2 = ((NI) 0);
					T7_ = colontmp__2.len;
					L = T7_;
					{
						while (1) {
							NI colontmpD__2;
							NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
							if (!(i_2 < L)) goto LA9;
							colontmpD__2 = (NI)0;
							j = i_2;
							if ((NU)(i_2) >= (NU)colontmp__2.len){ raiseIndexError2(i_2,colontmp__2.len-1); goto LA1_;
}
							elm = colontmp__2.p->data[i_2];
							if ((NU)(elm) >= (NU)s.s.len){ raiseIndexError2(elm,s.s.len-1); goto LA1_;
}
							colontmpD__2 = s.s.p->data[elm].n;
							add__MIAbjRZGBQlNfywJeCn8AQ((&ss), colontmpD__2);
							if (nimAddInt(i_2, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto LA1_;
};
							i_2 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
							{
								NI T12_;
								T12_ = colontmp__2.len;
								if (!!((T12_ == L))) goto LA13_;
								failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_5);
								if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
							}
							LA13_: ;
						} LA9: ;
					}
					eqdestroy___2FaMhgTYqczm61zqlScqSg((&colontmp__2));
				}
				if (nimAddInt(res, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_6)) { raiseOverflow(); goto LA1_;
};
				res = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_6);
			} LA5: ;
		}
	}
	colontmpD_ = dollar___Gsa4WPnABj84BVdJHxUK1w(ss);
	if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
	T15_[0] = colontmpD_;
	echoBinSafe(T15_, 1);
	{
		LA1_:;
	}
	{
		eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&colontmpD_));
		eqdestroy___2FaMhgTYqczm61zqlScqSg((&ss));
	}
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}BeforeRet_: ;
	popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* 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();
	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) {
{
NIM_BOOL* nimErr_;
	nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
	doSomething__UfHtkKYoEZKt9aI70lEbS0g(foo__D3je05E39cIF7fHazGtqROg);
	if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	{
		if (!NIM_TRUE) goto LA3_;
		failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(TM__SRd76hP9cMfCzdUO857UhQQ_11);
		if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
	}
	LA3_: ;
	BeforeRet_: ;
	nimTestErrorFlag();
	popFrame();
}
}

AST

nnkStmtList.newTree(
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("Node"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("n"),
            newIdentNode("int"),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("next"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("int")
            ),
            newEmptyNode()
          ),
          nnkIdentDefs.newTree(
            newIdentNode("foobar"),
            newIdentNode("FooBar"),
            newEmptyNode()
          )
        )
      )
    ),
    nnkTypeDef.newTree(
      newIdentNode("FooBar"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("s"),
            nnkBracketExpr.newTree(
              newIdentNode("seq"),
              newIdentNode("Node")
            ),
            newEmptyNode()
          )
        )
      )
    )
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("Node")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("Node"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    nnkAccQuoted.newTree(
      newIdentNode("="),
      newIdentNode("copy")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("dest"),
        nnkVarTy.newTree(
          newIdentNode("FooBar")
        ),
        newEmptyNode()
      ),
      nnkIdentDefs.newTree(
        newIdentNode("source"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    nnkPragma.newTree(
      newIdentNode("error")
    ),
    newEmptyNode(),
    newEmptyNode()
  ),
  nnkProcDef.newTree(
    newIdentNode("doSomething"),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("s"),
        newIdentNode("FooBar"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkVarSection.newTree(
        nnkIdentDefs.newTree(
          newIdentNode("ss"),
          nnkBracketExpr.newTree(
            newIdentNode("seq"),
            newIdentNode("int")
          ),
          newEmptyNode()
        )
      ),
      nnkForStmt.newTree(
        newIdentNode("i"),
        nnkInfix.newTree(
          newIdentNode(".."),
          newLit(0),
          nnkInfix.newTree(
            newIdentNode("-"),
            nnkDotExpr.newTree(
              nnkDotExpr.newTree(
                newIdentNode("s"),
                newIdentNode("s")
              ),
              newIdentNode("len")
            ),
            newLit(1)
          )
        ),
        nnkStmtList.newTree(
          nnkForStmt.newTree(
            newIdentNode("j"),
            newIdentNode("elm"),
            nnkCommand.newTree(
              newIdentNode("pairs"),
              nnkDotExpr.newTree(
                nnkBracketExpr.newTree(
                  nnkDotExpr.newTree(
                    newIdentNode("s"),
                    newIdentNode("s")
                  ),
                  newIdentNode("i")
                ),
                newIdentNode("next")
              )
            ),
            nnkStmtList.newTree(
              nnkCommand.newTree(
                nnkDotExpr.newTree(
                  newIdentNode("ss"),
                  newIdentNode("add")
                ),
                nnkDotExpr.newTree(
                  nnkBracketExpr.newTree(
                    nnkDotExpr.newTree(
                      newIdentNode("s"),
                      newIdentNode("s")
                    ),
                    newIdentNode("elm")
                  ),
                  newIdentNode("n")
                )
              )
            )
          )
        )
      ),
      nnkCommand.newTree(
        newIdentNode("echo"),
        newIdentNode("ss")
      )
    )
  ),
  nnkWhenStmt.newTree(
    nnkElifBranch.newTree(
      newIdentNode("isMainModule"),
      nnkStmtList.newTree(
        nnkConstSection.newTree(
          nnkConstDef.newTree(
            newIdentNode("foo"),
            newEmptyNode(),
            nnkObjConstr.newTree(
              newIdentNode("FooBar"),
              nnkExprColonExpr.newTree(
                newIdentNode("s"),
                nnkPrefix.newTree(
                  newIdentNode("@"),
                  nnkBracket.newTree(
                    nnkObjConstr.newTree(
                      newIdentNode("Node"),
                      nnkExprColonExpr.newTree(
                        newIdentNode("n"),
                        newLit(1)
                      ),
                      nnkExprColonExpr.newTree(
                        newIdentNode("next"),
                        nnkPrefix.newTree(
                          newIdentNode("@"),
                          nnkBracket.newTree(
                            newLit(0)
                          )
                        )
                      )
                    )
                  )
                )
              )
            )
          )
        ),
        nnkCall.newTree(
          newIdentNode("doSomething"),
          newIdentNode("foo")
        ),
        nnkCommand.newTree(
          newIdentNode("doAssert"),
          newIdentNode("off")
        )
      )
    )
  )
)
Stats
  • GCC 11.4.0
  • LibC 2.35
  • Valgrind 3.18.1
  • NodeJS 17.1
  • Linux 5.15.0
  • Created 2023-08-25T12:37:47Z
  • Comments 4
  • Commands nim c --gc:orc -d:nimArcDebug -d:nimArcIds --run -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --warnings: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 49 minutes bisecting 8 commits at 0 commits per second.

@nitely
Copy link
Contributor Author

nitely commented Aug 25, 2023

@ringabout here's a test case, maybe it's useful

type
  Idx = object
    i: int
  Node = object
    n: int
    next: seq[Idx]
  FooBar = object
    s: seq[Node]

proc `=copy`(dest: var Idx; source: Idx) {.error.}
proc `=copy`(dest: var Node; source: Node) {.error.}
proc `=copy`(dest: var FooBar; source: FooBar) {.error.}

proc doSomething(ss: var seq[int], s: FooBar) =
  for i in 0 .. s.s.len-1:
    for elm in items s.s[i].next:
      ss.add s.s[elm.i].n

when isMainModule:
  const foo = FooBar(s: @[Node(n: 1, next: @[Idx(i: 0)])])
  var ss: seq[int]
  doSomething(ss, foo)
  doAssert ss == @[1]

it throws

bug.nim(18, 28) Error: '=copy' is not available for type <seq[Idx]>; requires a copy because it's not the last read of 's.s[i].next'; routine: doSomething

@ringabout
Copy link
Member

@nitely Thanks for your test case! It's really helpful!

Araq added a commit that referenced this issue Nov 30, 2023
@Araq Araq closed this as completed in 0d24f76 Dec 2, 2023
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