nim-lang / Nim

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

Wrong behaviour when wrapping a constant object variant into a sequence at runtime #23295

Closed mjfh closed 8 months ago

mjfh commented 9 months ago

Description

# This is a sample code, the first echo statement prints out the error
type
  A = object
    case w: uint8
    of 0:
      n: int
    else:
      other: string
const
  a = A(w: 0, n: 5)
  q = @[a]
let
  b = a

echo ">>> a=", a, " @[a][0]=", @[a][0] # a=(w: 0, n: 5) @[a][0]=(w: 0, n: 0) err
echo ">>> b=", b, " @[b][0]=", @[b][0] # a=(w: 0, n: 5) @[a][0]=(w: 0, n: 5) ok
echo ">>> q[0]=", q[0]                 # q[0]=(w: 0, n: 5)                   ok

Nim Version

Nim Compiler Version 1.6.18 [Linux: amd64] Compiled at 2024-02-05 Copyright (c) 2006-2023 by Andreas Rumpf

Current Output

>>> a=(w: 0, n: 5) @[a][0]=(w: 0, n: 0)
>>> a=(w: 0, n: 5) @[a][0]=(w: 0, n: 5)
>>> q[0]=(w: 0, n: 5)

Expected Output

>>> a=(w: 0, n: 5) @[a][0]=(w: 0, n: 5)
>>> a=(w: 0, n: 5) @[a][0]=(w: 0, n: 5)
>>> q[0]=(w: 0, n: 5)

Possible Solution

no idea, the workaround is using let instead of const

Additional Information

Nim compiler is compiled as part of nimbus-eth1

ringabout commented 9 months ago

!nim c

# This is a sample code, the first echo statement prints out the error
type
  A = object
    case w: uint8
    of 1:
      n: int
    else:
      other: string

const
  a = A(w: 1, n: 5)

proc foo =

  let c = [a]
  doAssert c[0].n == 5

foo()
github-actions[bot] commented 9 months ago
:penguin: Linux bisect by @ringabout (member)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /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(13, 3) `c[0].n == 5` [AssertionDefect] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 98.56 Kb (100,928 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__LoXtP80qa614YAyMCI5c8g tyObject_A__LoXtP80qa614YAyMCI5c8g; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; struct tyObject_A__LoXtP80qa614YAyMCI5c8g { NU8 w; union{ struct { NI n; } _w_1; struct { NimStringV2 other; } _w_2; }; }; typedef tyObject_A__LoXtP80qa614YAyMCI5c8g tyArray__Um9bzX7KPu4tZIRGmrx18oQ[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f_p0, NI discVal_p1); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u254)(NimStringV2 msg_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4599)(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[0+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0 | NIM_STRLIT_FLAG, "" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; static const struct { NI cap; NIM_CHAR data[52+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_5 = { 52 | NIM_STRLIT_FLAG, "field \'n\' is not accessible for type \'A\' using \'w = " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_6 = {52, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_5}; static const struct { NI cap; NIM_CHAR data[56+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_7 = { 56 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(13, 3) `c[0].n == 5` " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_8 = {56, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4383; extern NIM_THREADVAR TFrame* framePtr__system_u4047; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4383); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0) { NI colontmp_; colontmp_ = ((NI)0); { while (1) { if (!(colontmp_ < ((NI)1))) goto LA2; switch (dest_p0[(colontmp_)- 0].w) { case ((NU8)1): { } break; default: { if (dest_p0[(colontmp_)- 0]._w_2.other.p && !(dest_p0[(colontmp_)- 0]._w_2.other.p->cap & NIM_STRLIT_FLAG)) { deallocShared(dest_p0[(colontmp_)- 0]._w_2.other.p); } } break; } colontmp_ += ((NI)1); } LA2: ; } } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4047 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4047).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4047; framePtr__system_u4047 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4599(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4047 = (*framePtr__system_u4047).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void) { tyArray__Um9bzX7KPu4tZIRGmrx18oQ c; tyObject_A__LoXtP80qa614YAyMCI5c8g T1_; NIM_BOOL* nimErr_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)c, sizeof(tyArray__Um9bzX7KPu4tZIRGmrx18oQ)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__LoXtP80qa614YAyMCI5c8g)); T1_.w = ((NU8)1); T1_._w_1.n = ((NI)5); T1_._w_2.other = TM__SRd76hP9cMfCzdUO857UhQQ_3; c[0] = T1_; { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_4[(NU)((c[(((NI)0))- 0].w))>>3] &(1U<<((NU)((c[(((NI)0))- 0].w))&7U)))!=0))) { raiseFieldError2(TM__SRd76hP9cMfCzdUO857UhQQ_6, (NI)(c[(((NI)0))- 0].w)); goto BeforeRet_; } if (!!((c[(((NI)0))- 0]._w_1.n == ((NI)5)))) goto LA4_; failedAssertImpl__stdZassertions_u254(TM__SRd76hP9cMfCzdUO857UhQQ_8); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } LA4_: ; eqdestroy___temp_u16(c); }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(); foo__temp_u6(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:56:48
  • Finished 2024-02-09T08:56:50
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
stable :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /home/runner/.choosenim/toolchains/nim-2.0.2/lib/std/assertions.nim failedAssertImpl /home/runner/.choosenim/toolchains/nim-2.0.2/lib/std/assertions.nim raiseAssert /home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/fatal.nim sysFatal Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(13, 3) `c[0].n == 5` [AssertionDefect] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 96.48 Kb (98,800 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__LoXtP80qa614YAyMCI5c8g tyObject_A__LoXtP80qa614YAyMCI5c8g; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; struct tyObject_A__LoXtP80qa614YAyMCI5c8g { NU8 w; union{ struct { NI n; } _w_1; struct { NimStringV2 other; } _w_2; }; }; typedef tyObject_A__LoXtP80qa614YAyMCI5c8g tyArray__Um9bzX7KPu4tZIRGmrx18oQ[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f_p0, NI discVal_p1); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[0+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0 | NIM_STRLIT_FLAG, "" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; static const struct { NI cap; NIM_CHAR data[52+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_5 = { 52 | NIM_STRLIT_FLAG, "field \'n\' is not accessible for type \'A\' using \'w = " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_6 = {52, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_5}; static const struct { NI cap; NIM_CHAR data[56+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_7 = { 56 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(13, 3) `c[0].n == 5` " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_8 = {56, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403; extern NIM_THREADVAR TFrame* framePtr__system_u4020; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4403); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0) { NI colontmp_; colontmp_ = ((NI)0); { while (1) { if (!(colontmp_ < ((NI)1))) goto LA2; switch (dest_p0[(colontmp_)- 0].w) { case ((NU8)1): { } break; default: { if (dest_p0[(colontmp_)- 0]._w_2.other.p && !(dest_p0[(colontmp_)- 0]._w_2.other.p->cap & NIM_STRLIT_FLAG)) { deallocShared(dest_p0[(colontmp_)- 0]._w_2.other.p); } } break; } colontmp_ += ((NI)1); } LA2: ; } } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4020; framePtr__system_u4020 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4621(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4020 = (*framePtr__system_u4020).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void) { tyArray__Um9bzX7KPu4tZIRGmrx18oQ c; tyObject_A__LoXtP80qa614YAyMCI5c8g T1_; NIM_BOOL* nimErr_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)c, sizeof(tyArray__Um9bzX7KPu4tZIRGmrx18oQ)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__LoXtP80qa614YAyMCI5c8g)); T1_.w = ((NU8)1); T1_._w_1.n = ((NI)5); T1_._w_2.other = TM__SRd76hP9cMfCzdUO857UhQQ_3; c[0] = T1_; { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_4[(NU)((c[(((NI)0))- 0].w))>>3] &(1U<<((NU)((c[(((NI)0))- 0].w))&7U)))!=0))) { raiseFieldError2(TM__SRd76hP9cMfCzdUO857UhQQ_6, (NI)(c[(((NI)0))- 0].w)); goto BeforeRet_; } if (!!((c[(((NI)0))- 0]._w_1.n == ((NI)5)))) goto LA4_; failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_8); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } LA4_: ; eqdestroy___temp_u16(c); 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_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(); foo__temp_u6(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:56:51
  • Finished 2024-02-09T08:56:52
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
2.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /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(13, 3) `c[0].n == 5` [AssertionDefect] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 96.48 Kb (98,800 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__LoXtP80qa614YAyMCI5c8g tyObject_A__LoXtP80qa614YAyMCI5c8g; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; struct tyObject_A__LoXtP80qa614YAyMCI5c8g { NU8 w; union{ struct { NI n; } _w_1; struct { NimStringV2 other; } _w_2; }; }; typedef tyObject_A__LoXtP80qa614YAyMCI5c8g tyArray__Um9bzX7KPu4tZIRGmrx18oQ[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringV2 f_p0, NI discVal_p1); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, 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[0+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0 | NIM_STRLIT_FLAG, "" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {0, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_4 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; static const struct { NI cap; NIM_CHAR data[52+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_5 = { 52 | NIM_STRLIT_FLAG, "field \'n\' is not accessible for type \'A\' using \'w = " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_6 = {52, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_5}; static const struct { NI cap; NIM_CHAR data[56+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_7 = { 56 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(13, 3) `c[0].n == 5` " }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_8 = {56, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_7}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389; extern NIM_THREADVAR TFrame* framePtr__system_u4006; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u4389); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u16)(tyObject_A__LoXtP80qa614YAyMCI5c8g* dest_p0) { NI colontmp_; colontmp_ = ((NI)0); { while (1) { if (!(colontmp_ < ((NI)1))) goto LA2; switch (dest_p0[(colontmp_)- 0].w) { case ((NU8)1): { } break; default: { if (dest_p0[(colontmp_)- 0]._w_2.other.p && !(dest_p0[(colontmp_)- 0]._w_2.other.p->cap & NIM_STRLIT_FLAG)) { deallocShared(dest_p0[(colontmp_)- 0]._w_2.other.p); } } break; } colontmp_ += ((NI)1); } LA2: ; } } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4006; framePtr__system_u4006 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4607(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4006 = (*framePtr__system_u4006).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__temp_u6)(void) { tyArray__Um9bzX7KPu4tZIRGmrx18oQ c; tyObject_A__LoXtP80qa614YAyMCI5c8g T1_; NIM_BOOL* nimErr_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)c, sizeof(tyArray__Um9bzX7KPu4tZIRGmrx18oQ)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__LoXtP80qa614YAyMCI5c8g)); T1_.w = ((NU8)1); T1_._w_1.n = ((NI)5); T1_._w_2.other = TM__SRd76hP9cMfCzdUO857UhQQ_3; c[0] = T1_; { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_4[(NU)((c[(((NI)0))- 0].w))>>3] &(1U<<((NU)((c[(((NI)0))- 0].w))&7U)))!=0))) { raiseFieldError2(TM__SRd76hP9cMfCzdUO857UhQQ_6, (NI)(c[(((NI)0))- 0].w)); goto BeforeRet_; } if (!!((c[(((NI)0))- 0]._w_1.n == ((NI)5)))) goto LA4_; failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_8); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } LA4_: ; eqdestroy___temp_u16(c); 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(); foo__temp_u6(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:56:55
  • Finished 2024-02-09T08:56:55
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
1.6.14 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/assertions.nim failedAssertImpl /home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/assertions.nim raiseAssert /home/runner/.choosenim/toolchains/nim-1.6.14/lib/system/fatal.nim sysFatal Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` [AssertionDefect] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' fatal.nim(54) sysFatal Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 104.73 Kb (107,248 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__LoXtP80qa614YAyMCI5c8g tyObject_A__LoXtP80qa614YAyMCI5c8g; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct tyObject_A__LoXtP80qa614YAyMCI5c8g { NU8 w; union{ struct {NI n; } _w_1; struct {NimStringDesc* other; } _w_2; }; }; typedef tyObject_A__LoXtP80qa614YAyMCI5c8g tyArray__Um9bzX7KPu4tZIRGmrx18oQ[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; typedef NU8 tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ; typedef NU8 tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p); struct TNimType { NI size; NI align; tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ kind; tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; typedef NU8 tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w; struct TNimNode { tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w kind; NI offset; TNimType* typ; NCSTRING name; NI len; TNimNode** sons; }; N_LIB_PRIVATE N_NIMCALL(void, foo__temp_21)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size); static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError2)(NimStringDesc* f, NimStringDesc* discVal); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, reprDiscriminant)(NI e, TNimType* typ); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__systemZassertions_56)(NimStringDesc* msg); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_2997)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "field \'n\' is not accessible for type \'A\' using \'w = ", 52); extern TNimType NTIuint56__k3HXouOuhqAKq0dx450lXQ_; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "/home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` ", 57); extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; extern TFrame* framePtr__system_2564; static N_INLINE(void, nimSetMem__systemZmemory_7)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__systemZmemory_7(p, ((int) 0), size); } static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) { void* T1_; T1_ = (void*)0; T1_ = memcpy(dest, source, ((size_t) (size))); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_2564 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_2564).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_2564; framePtr__system_2564 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_2997(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_2564 = (*framePtr__system_2564).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__temp_21)(void) { tyArray__Um9bzX7KPu4tZIRGmrx18oQ c; tyObject_A__LoXtP80qa614YAyMCI5c8g T1_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)c, sizeof(tyArray__Um9bzX7KPu4tZIRGmrx18oQ)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__LoXtP80qa614YAyMCI5c8g)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__LoXtP80qa614YAyMCI5c8g)); T1_.w = ((NU8) 1); T1_._w_1.n = ((NI) 5); T1_._w_2.other = ((NimStringDesc*) NIM_NIL); nimCopyMem((void*)(&c[0]), (NIM_CONST void*)(&T1_), sizeof(c[0])); { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_2[(NU)(c[(((NI) 0))- 0].w)>>3] &(1U<<((NU)(c[(((NI) 0))- 0].w)&7U)))!=0))) { raiseFieldError2(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3), reprDiscriminant(((NI)c[(((NI) 0))- 0].w) + (NI)IL64(0), (&NTIuint56__k3HXouOuhqAKq0dx450lXQ_))); } if (!!((c[(((NI) 0))- 0]._w_1.n == ((NI) 5)))) goto LA4_; failedAssertImpl__systemZassertions_56(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4)); } LA4_: ; popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000(); (*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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); foo__temp_21(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:56:58
  • Finished 2024-02-09T08:56:58
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
1.4.8 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/assertions.nim failedAssertImpl /home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/assertions.nim raiseAssert /home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/fatal.nim sysFatal Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` [AssertionDefect] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 92.17 Kb (94,384 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__sGiPw74veAtIZv0NvP6m8w tyObject_A__sGiPw74veAtIZv0NvP6m8w; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct tyObject_A__sGiPw74veAtIZv0NvP6m8w { NU8 w; union{ struct {NI n; } _w_1; struct {NimStringDesc* other; } _w_2; }; }; typedef tyObject_A__sGiPw74veAtIZv0NvP6m8w tyArray__UcqMU0ZZgIW8Y82ZfuGTpg[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError)(NimStringDesc* f); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "\'n\' is not accessible using discriminant \'w\' of type \'A\'", 56); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "/home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` ", 57); 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(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) { void* T1_; T1_ = (void*)0; T1_ = memcpy(dest, source, ((size_t) (size))); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void) { tyArray__UcqMU0ZZgIW8Y82ZfuGTpg c; tyObject_A__sGiPw74veAtIZv0NvP6m8w T1_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)c, sizeof(tyArray__UcqMU0ZZgIW8Y82ZfuGTpg)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); T1_.w = ((NU8) 1); T1_._w_1.n = ((NI) 5); T1_._w_2.other = ((NimStringDesc*) NIM_NIL); nimCopyMem((void*)(&c[0]), (NIM_CONST void*)(&T1_), sizeof(c[0])); { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_2[(NU)(c[(((NI) 0))- 0].w)>>3] &(1U<<((NU)(c[(((NI) 0))- 0].w)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3)); } if (!!((c[(((NI) 0))- 0]._w_1.n == ((NI) 5)))) goto LA4_; failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4)); } LA4_: ; popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); foo__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:57:00
  • Finished 2024-02-09T08:57:01
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
1.2.18 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/assertions.nim failedAssertImpl /home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/assertions.nim raiseAssert /home/runner/.choosenim/toolchains/nim-1.2.18/lib/system/fatal.nim sysFatal Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` [AssertionError] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 91.90 Kb (94,104 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__sGiPw74veAtIZv0NvP6m8w tyObject_A__sGiPw74veAtIZv0NvP6m8w; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct tyObject_A__sGiPw74veAtIZv0NvP6m8w { NU8 w; union{ struct {NI n; } _w_1; struct {NimStringDesc* other; } _w_2; }; }; typedef tyObject_A__sGiPw74veAtIZv0NvP6m8w tyArray__UcqMU0ZZgIW8Y82ZfuGTpg[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size); N_LIB_PRIVATE N_NOINLINE(void, raiseFieldError)(NimStringDesc* f); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "\'n\' is not accessible using discriminant \'w\' of type \'A\'", 56); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "/home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` ", 57); 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(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) { void* T1_; T1_ = (void*)0; T1_ = memcpy(dest, source, ((size_t) (size))); } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void) { tyArray__UcqMU0ZZgIW8Y82ZfuGTpg c; tyObject_A__sGiPw74veAtIZv0NvP6m8w T1_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)c, sizeof(tyArray__UcqMU0ZZgIW8Y82ZfuGTpg)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); T1_.w = ((NU8) 1); T1_._w_1.n = ((NI) 5); T1_._w_2.other = ((NimStringDesc*) NIM_NIL); nimCopyMem((void*)(&c[0]), (NIM_CONST void*)(&T1_), sizeof(c[0])); { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_2[(NU)(c[(((NI) 0))- 0].w)>>3] &(1U<<((NU)(c[(((NI) 0))- 0].w)&7U)))!=0))){ raiseFieldError(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3)); } if (!!((c[(((NI) 0))- 0]._w_1.n == ((NI) 5)))) goto LA4_; failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4)); } LA4_: ; popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); foo__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:57:03
  • Finished 2024-02-09T08:57:03
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
1.0.10 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim /home/runner/work/Nim/Nim/temp.nim temp /home/runner/work/Nim/Nim/temp.nim foo /home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/assertions.nim failedAssertImpl /home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/assertions.nim raiseAssert /home/runner/.choosenim/toolchains/nim-1.0.10/lib/system/fatal.nim sysFatal Error: unhandled exception: /home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` [AssertionError] Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 86.95 Kb (89,040 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_A__sGiPw74veAtIZv0NvP6m8w tyObject_A__sGiPw74veAtIZv0NvP6m8w; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct tyObject_A__sGiPw74veAtIZv0NvP6m8w { NU8 w; union{ struct {NI n; }; struct {NimStringDesc* other; }; }; }; typedef tyObject_A__sGiPw74veAtIZv0NvP6m8w tyArray__UcqMU0ZZgIW8Y82ZfuGTpg[1]; typedef NU8 tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ[32]; N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size); N_NOINLINE(void, raiseFieldError)(NimStringDesc* f); N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A)(NimStringDesc* msg); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, initStackBottomWith)(void* locals); N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); 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 NIM_CONST tySet_tyUInt8__k3HXouOuhqAKq0dx450lXQ TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} ; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_3, "\'n\' is not accessible using discriminant \'w\' of type \'A\'", 56); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_4, "/home/runner/work/Nim/Nim/temp.nim(13, 12) `c[0].n == 5` ", 57); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, nimCopyMem)(void* dest, void* source, NI size) { void* T1_; T1_ = (void*)0; T1_ = memcpy(dest, source, ((size_t) (size))); } static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_; T1_ = (NI)0; { if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_; T1_ = ((NI) 0); } goto LA2_; LA4_: ; { T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1)))); } LA2_: ; (*s).calldepth = ((NI16) (T1_)); (*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s; { if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA9_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, foo__EzBZaa239as9bFx8yeHDoTOw)(void) { tyArray__UcqMU0ZZgIW8Y82ZfuGTpg c; tyObject_A__sGiPw74veAtIZv0NvP6m8w T1_; nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim"); nimZeroMem((void*)c, sizeof(tyArray__UcqMU0ZZgIW8Y82ZfuGTpg)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); nimZeroMem((void*)(&T1_), sizeof(tyObject_A__sGiPw74veAtIZv0NvP6m8w)); T1_.w = ((NU8) 1); T1_.n = ((NI) 5); T1_.other = ((NimStringDesc*) NIM_NIL); nimCopyMem((void*)(&c[0]), (NIM_CONST void*)(&T1_), sizeof(c[0])); { if (!(((TM__SRd76hP9cMfCzdUO857UhQQ_2[(NU)(c[(((NI) 0))- 0].w)>>3] &(1U<<((NU)(c[(((NI) 0))- 0].w)&7U)))!=0))) raiseFieldError(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_3)); if (!!((c[(((NI) 0))- 0].n == ((NI) 5)))) goto LA4_; failedAssertImpl__W9cjVocn1tjhW7p7xohJj6A(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_4)); } LA4_: ; popFrame(); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } void PreMainInner(void) { } int cmdCount; char** cmdLine; char** gEnv; void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); (*inner)(); } N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); foo__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-02-09T08:57:05
  • Finished 2024-02-09T08:57:06
  • Duration

AST

```nim nnkStmtList.newTree( nnkTypeSection.newTree( nnkTypeDef.newTree( newIdentNode("A"), newEmptyNode(), nnkObjectTy.newTree( newEmptyNode(), newEmptyNode(), nnkRecList.newTree( nnkRecCase.newTree( nnkIdentDefs.newTree( newIdentNode("w"), newIdentNode("uint8"), newEmptyNode() ), nnkOfBranch.newTree( newLit(1), nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("n"), newIdentNode("int"), newEmptyNode() ) ) ), nnkElse.newTree( nnkRecList.newTree( nnkIdentDefs.newTree( newIdentNode("other"), newIdentNode("string"), newEmptyNode() ) ) ) ) ) ) ) ), nnkConstSection.newTree( nnkConstDef.newTree( newIdentNode("a"), newEmptyNode(), nnkObjConstr.newTree( newIdentNode("A"), nnkExprColonExpr.newTree( newIdentNode("w"), newLit(1) ), nnkExprColonExpr.newTree( newIdentNode("n"), newLit(5) ) ) ) ), nnkProcDef.newTree( newIdentNode("foo"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkLetSection.newTree( nnkIdentDefs.newTree( newIdentNode("c"), newEmptyNode(), nnkBracket.newTree( newIdentNode("a") ) ) ), nnkCommand.newTree( newIdentNode("doAssert"), nnkInfix.newTree( newIdentNode("=="), nnkDotExpr.newTree( nnkBracketExpr.newTree( newIdentNode("c"), newLit(0) ), newIdentNode("n") ), newLit(5) ) ) ) ), nnkCall.newTree( newIdentNode("foo") ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 19.0
  • Created 2024-02-09T08:56:19Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

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