nim-lang / Nim

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

Calling algorithm reverse causes a SIGSEGV on ORC #24141

Closed nitely closed 1 month ago

nitely commented 1 month ago

Description

The following code runs on refc, but sigsegv on orc:

import std/algorithm

func rev(s: var string) =
  s.reverse

proc main =
  var abc = "abc"
  abc.rev
  echo abc

main()

Nim Version

Nim Compiler Version 2.1.99 [Linux: amd64] Compiled at 2024-09-18 Copyright (c) 2006-2024 by Andreas Rumpf

git hash: 04ccd2f4f07a169a03db3cc6f9316628c03f214a active boot switches: -d:release

Current Output

Traceback (most recent call last)
/home/esteban/AtomProjects/crap/bug.nim(11) bug
/home/esteban/AtomProjects/crap/bug.nim(8) main
/home/esteban/AtomProjects/crap/bug.nim(4) rev
/home/esteban/.choosenim/toolchains/nim-#devel/lib/pure/algorithm.nim(136) reverse
/home/esteban/.choosenim/toolchains/nim-#devel/lib/pure/algorithm.nim(119) reverse
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation fault (core dumped)
Error: execution of an external program failed: '/home/esteban/AtomProjects/crap/bug'

Expected Output

No response

Known Workarounds

No response

Additional Information

No response

ringabout commented 1 month ago

!nim c

import std/algorithm

func rev(s: var string) =
  s.reverse

proc main =
  var abc = "abc"
  abc.rev
  echo abc

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

Output

``` ```

IR

Compiled filesize 91.23 Kb (93,416 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); 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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:35
  • Finished 2024-09-19T00:54:36
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
stable :-1: FAIL

Output

``` ```

IR

Compiled filesize 93.45 Kb (95,688 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402; extern NIM_THREADVAR TFrame* framePtr__system_u4059; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4402); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4059 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4059; framePtr__system_u4059 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4620(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4059 = (*framePtr__system_u4059).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:39
  • Finished 2024-09-19T00:54:40
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
2.0.8 :-1: FAIL

Output

``` ```

IR

Compiled filesize 93.45 Kb (95,688 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402; extern NIM_THREADVAR TFrame* framePtr__system_u4059; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4402); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4059 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4059; framePtr__system_u4059 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4620(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4059 = (*framePtr__system_u4059).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:40
  • Finished 2024-09-19T00:54:41
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
2.0.0 :-1: FAIL

Output

``` ```

IR

Compiled filesize 91.31 Kb (93,504 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); 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, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); 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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389; extern NIM_THREADVAR TFrame* framePtr__system_u4006; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u4389); return result; } 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, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:44
  • Finished 2024-09-19T00:54:45
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
1.6.20 :+1: OK

Output

``` ```

IR

Compiled filesize 96.28 Kb (98,592 bytes) ```cpp #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 NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringDesc** s); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a, NI aLen_0); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u2997)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_2, "abc", 3); extern TFrame* framePtr__system_u2564; static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u2564 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u2564).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u2564; framePtr__system_u2564 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u2997(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2564 = (*framePtr__system_u2564).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringDesc** s) { nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); reverse__temp_u4((*s) ? ((*s)->data) : NIM_NIL, ((*s) ? (*s)->Sup.len : 0)); popFrame(); } static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__systemZmemory_u7(p, ((int) 0), size); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void) { NimStringDesc* abc; tyArray__nHXaesL0DJZHyVS07ARPRA T1_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); abc = copyString(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_2)); rev__temp_u2((&abc)); nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T1_[0] = copyString(abc); echoBinSafe(T1_, 1); 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_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"); main__temp_u29(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:47
  • Finished 2024-09-19T00:54:48
  • Duration
1.4.8 :+1: OK

Output

``` ```

IR

Compiled filesize 96.83 Kb (99,152 bytes) ```cpp #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 NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src); N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s); N_LIB_PRIVATE N_NIMCALL(void, reverse__ZFWXZRLpsKFl2OzCm4rOZA)(NIM_CHAR* a, NI aLen_0); 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, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_2, "abc", 3); 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, 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, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s) { nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); reverse__ZFWXZRLpsKFl2OzCm4rOZA((*s)->data, ((*s) ? (*s)->Sup.len : 0)); popFrame(); } static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { NimStringDesc* abc; tyArray__nHXaesL0DJZHyVS07ARPRA T1_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); abc = copyString(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_2)); rev__M33htTarT3MPij9aNZoCdAg((&abc)); nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T1_[0] = copyString(abc); echoBinSafe(T1_, 1); 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"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:49
  • Finished 2024-09-19T00:54:50
  • Duration
1.2.18 :+1: OK

Output

``` ```

IR

Compiled filesize 92.55 Kb (94,776 bytes) ```cpp #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 NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src); N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s); N_LIB_PRIVATE N_NIMCALL(void, reverse__ZFWXZRLpsKFl2OzCm4rOZA)(NIM_CHAR* a, NI aLen_0); 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, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); static N_INLINE(void, initStackBottomWith)(void* locals); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_2, "abc", 3); 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, 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, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s) { nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); reverse__ZFWXZRLpsKFl2OzCm4rOZA((*s)->data, ((*s) ? (*s)->Sup.len : 0)); popFrame(); } static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { NimStringDesc* abc; tyArray__nHXaesL0DJZHyVS07ARPRA T1_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); abc = copyString(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_2)); rev__M33htTarT3MPij9aNZoCdAg((&abc)); nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T1_[0] = copyString(abc); echoBinSafe(T1_, 1); 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"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:52
  • Finished 2024-09-19T00:54:52
  • Duration
1.0.10 :+1: OK

Output

``` ```

IR

Compiled filesize 91.66 Kb (93,856 bytes) ```cpp #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 NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; typedef NimStringDesc* tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); N_NIMCALL(NimStringDesc*, copyString)(NimStringDesc* src); N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s); N_LIB_PRIVATE N_NIMCALL(void, reverse__ZFWXZRLpsKFl2OzCm4rOZA)(NIM_CHAR* a, NI aLen_0); 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, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); N_NIMCALL(void, echoBinSafe)(NimStringDesc** args, NI argsLen_0); static N_INLINE(void, initStackBottomWith)(void* locals); N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom); N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; STRING_LITERAL(TM__SRd76hP9cMfCzdUO857UhQQ_2, "abc", 3); 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, rev__M33htTarT3MPij9aNZoCdAg)(NimStringDesc** s) { nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); reverse__ZFWXZRLpsKFl2OzCm4rOZA((*s)->data, ((*s) ? (*s)->Sup.len : 0)); popFrame(); } static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { NimStringDesc* abc; tyArray__nHXaesL0DJZHyVS07ARPRA T1_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); abc = copyString(((NimStringDesc*) &TM__SRd76hP9cMfCzdUO857UhQQ_2)); rev__M33htTarT3MPij9aNZoCdAg((&abc)); nimZeroMem((void*)T1_, sizeof(tyArray__nHXaesL0DJZHyVS07ARPRA)); T1_[0] = copyString(abc); echoBinSafe(T1_, 1); 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"); main__EzBZaa239as9bFx8yeHDoTOw(); popFrame(); } } ```

Stats

  • Started 2024-09-19T00:54:54
  • Finished 2024-09-19T00:54:54
  • Duration
#7739e2342 :arrow_right: :bug:

Diagnostics

ringabout introduced a bug at 2022-09-23 19:05:05 +0800 on commit #7739e2342 with message: ``` defaults to ORC (#19972) * defaults to Orc * bootstrap using refc * use gc * init orc defines * unregister orc * fix gc * fix commands * add prepareMutation for orc * enable deepcopy for orc * prepareMutation * more fixes * some cases * bug #20081 * partial fixes * partial fixes * fixes command line * more fixes * build Nim with refc * use gc * more fixes * rstore * orc doesn't support threadpool * more shallowCopy * more fixes * fixes unsafeNew * workarounds * small * more fixes * fixes some megatest * tcodegenbugs1 refc * fxies megatest * build nimble with refc * workaround tensordsl tests * replace shallowCopy with move * fixes action * workaround * add todo * fixes important packages * unpublic unregisterArcOrc * fixes cpp * enable windows Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com> ``` The bug is in the files: ``` .github/workflows/ci_docs.yml compiler/commands.nim compiler/nim.nim compiler/options.nim koch.nim lib/system/iterators.nim nimsuggest/sexp.nim testament/categories.nim testament/important_packages.nim tests/assign/moverload_asgn2.nim tests/async/tasync_traceback.nim tests/ccgbugs/t13062.nim tests/ccgbugs/tassign_nil_strings.nim tests/ccgbugs/tcodegenbug1.nim tests/ccgbugs/tdeepcopy_addr_rval.nim tests/ccgbugs/thtiobj.nim tests/ccgbugs/tmissinginit.nim tests/ccgbugs/tmissingvolatile.nim tests/collections/tseq.nim tests/concepts/t3330.nim tests/concepts/tusertypeclasses.nim tests/destructor/tatomicptrs.nim tests/errmsgs/t10376.nim tests/exception/tcpp_imported_exc.nim tests/generics/tgeneric3.nim tests/generics/tparam_binding.nim tests/gensym/tgensymgeneric.nim tests/ic/config.nims tests/iter/tshallowcopy_closures.nim tests/macros/tstaticparamsmacro.nim tests/magics/t10307.nim tests/magics/tmagics.nim tests/manyloc/keineschweine/keineschweine.nim.cfg tests/manyloc/keineschweine/lib/estreams.nim tests/metatype/tmetatype_various.nim tests/metatype/tstaticparammacro.nim tests/metatype/tstaticvector.nim tests/misc/taddr.nim tests/misc/tnew.nim tests/misc/trunner_special.nim tests/misc/tunsignedconv.nim tests/modules/tmodule_name_clashes.nim tests/niminaction/Chapter3/various3.nim tests/objects/t4318.nim tests/objects/tobj_asgn_dont_slice.nim tests/objects/tobjconstr.nim tests/parallel/tconvexhull.nim tests/parallel/tdeepcopy.nim tests/parallel/tdeepcopy2.nim tests/parallel/tdisjoint_slice1.nim tests/parallel/tflowvar.nim tests/parallel/tinvalid_array_bounds.nim tests/parallel/tmissing_deepcopy.nim tests/parallel/tnon_disjoint_slice1.nim tests/parallel/tparfind.nim tests/parallel/tpi.nim tests/parallel/tsendtwice.nim tests/parallel/tsysspawn.nim tests/parallel/tuseafterdef.nim tests/parallel/twaitany.nim tests/parser/t12274.nim tests/pragmas/t12640.nim tests/pragmas/tnoreturn.nim tests/stdlib/mgenast.nim tests/stdlib/tgenast.nim tests/stdlib/thttpclient_ssl.nim tests/stdlib/tjson.nim tests/stdlib/tmitems.nim tests/stdlib/tstdlib_various.nim tests/stdlib/tstring.nim tests/stdlib/twchartoutf8.nim tests/system/tdeepcopy.nim tests/template/twrongmapit.nim tests/threads/tjsthreads.nim tests/threads/tonthreadcreation.nim tests/typerel/t4799_1.nim tests/typerel/t4799_2.nim tests/typerel/t4799_3.nim tests/typerel/ttypedesc_as_genericparam1.nim tests/typerel/ttypedesc_as_genericparam1_orc.nim tests/typerel/ttypedesc_as_genericparam2.nim ``` The bug can be in the commits: (Diagnostics sometimes off-by-one).
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-09-19T00:54:07Z
  • 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 40 mins bisecting 2494 commits at 61 commits per second

ringabout commented 1 month ago

!nim c --gc:arc

import std/algorithm

func rev(s: var string) =
  s.reverse

proc main =
  var abc = "abc"
  abc.rev
  echo abc

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

Output

``` ```

IR

Compiled filesize 86.73 Kb (88,808 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4225)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); 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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4033; extern NIM_THREADVAR TFrame* framePtr__system_u2640; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4033); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2640 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2640).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2640; framePtr__system_u2640 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4225(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2640 = (*framePtr__system_u2640).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:36
  • Finished 2024-09-19T02:37:36
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
stable :-1: FAIL

Output

``` ```

IR

Compiled filesize 88.84 Kb (90,976 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4170)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3978; extern NIM_THREADVAR TFrame* framePtr__system_u3653; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u3978); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u3653 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u3653).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u3653; framePtr__system_u3653 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4170(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3653 = (*framePtr__system_u3653).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:40
  • Finished 2024-09-19T02:37:41
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
2.0.8 :-1: FAIL

Output

``` ```

IR

Compiled filesize 88.84 Kb (90,976 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4170)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3978; extern NIM_THREADVAR TFrame* framePtr__system_u3653; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u3978); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u3653 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u3653).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u3653; framePtr__system_u3653 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4170(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3653 = (*framePtr__system_u3653).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:41
  • Finished 2024-09-19T02:37:42
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
2.0.0 :-1: FAIL

Output

``` ```

IR

Compiled filesize 86.70 Kb (88,784 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a_p0, NI a_p0Len_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); 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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967; extern NIM_THREADVAR TFrame* framePtr__system_u3605; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u3967); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u3605; framePtr__system_u3605 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4159(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3605 = (*framePtr__system_u3605).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s_p0) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s_p0).p) ? ((*s_p0).p->data) : NIM_NIL, (*s_p0).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u31)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { if (abc.p && !(abc.p->cap & NIM_STRLIT_FLAG)) { deallocShared(abc.p); } } 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(); main__temp_u31(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:45
  • Finished 2024-09-19T02:37:45
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
1.6.20 :-1: FAIL

Output

``` ```

IR

Compiled filesize 81.50 Kb (83,456 bytes) ```cpp #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a, NI aLen_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4055)(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_u3021)(NimStringV2* dest); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_BOOL nimInErrorMode__system_u3906; extern TFrame* framePtr__system_u3581; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u3906); return result; } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u3581 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u3581).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u3581; framePtr__system_u3581 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u4055(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3581 = (*framePtr__system_u3581).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s).p) ? ((*s).p->data) : NIM_NIL, (*s).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { eqdestroy___system_u3021((&abc)); } 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) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000(); PreMainInner(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { PreMain(); NimMainInner(); } 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(); main__temp_u29(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:49
  • Finished 2024-09-19T02:37:50
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
1.4.8 :-1: FAIL

Output

``` ```

IR

Compiled filesize 81.50 Kb (83,456 bytes) ```cpp #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s); N_LIB_PRIVATE N_NIMCALL(void, reverse__temp_u4)(NIM_CHAR* a, NI aLen_0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4055)(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_u3021)(NimStringV2* dest); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); static const struct { NI cap; NIM_CHAR data[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; extern NIM_BOOL nimInErrorMode__system_u3906; extern TFrame* framePtr__system_u3581; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u3906); return result; } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u3581 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u3581).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u3581; framePtr__system_u3581 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u4055(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3581 = (*framePtr__system_u3581).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__temp_u2)(NimStringV2* s) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__temp_u4(((*s).p) ? ((*s).p->data) : NIM_NIL, (*s).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__temp_u29)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__temp_u2((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { eqdestroy___system_u3021((&abc)); } 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) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000(); PreMainInner(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { PreMain(); NimMainInner(); } 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(); main__temp_u29(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:52
  • Finished 2024-09-19T02:37:52
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
1.2.18 :-1: FAIL

Output

``` ```

IR

Compiled filesize 73.83 Kb (75,600 bytes) ```cpp #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringV2* s); N_LIB_PRIVATE N_NIMCALL(void, reverse__ZFWXZRLpsKFl2OzCm4rOZA)(NIM_CHAR* a, NI aLen_0); 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, echoBinSafe)(NimStringV2* args, NI argsLen_0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; 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) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringV2* s) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__ZFWXZRLpsKFl2OzCm4rOZA((*s).p->data, (*s).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__M33htTarT3MPij9aNZoCdAg((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&abc)); } 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(); 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) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); main__EzBZaa239as9bFx8yeHDoTOw(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:55
  • Finished 2024-09-19T02:37:56
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
1.0.10 :-1: FAIL

Output

``` ```

IR

Compiled filesize 73.83 Kb (75,600 bytes) ```cpp #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringV2* s); N_LIB_PRIVATE N_NIMCALL(void, reverse__ZFWXZRLpsKFl2OzCm4rOZA)(NIM_CHAR* a, NI aLen_0); 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, echoBinSafe)(NimStringV2* args, NI argsLen_0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ)(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[3+1]; } TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 3 | NIM_STRLIT_FLAG, "abc" }; static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {3, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2}; 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) (((NI) 2000))))) goto LA8_; callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev; } N_LIB_PRIVATE N_NIMCALL(void, rev__M33htTarT3MPij9aNZoCdAg)(NimStringV2* s) { NIM_BOOL* nimErr_; nimfr_("rev", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); reverse__ZFWXZRLpsKFl2OzCm4rOZA((*s).p->data, (*s).len); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(void, main__EzBZaa239as9bFx8yeHDoTOw)(void) { NimStringV2 abc; tyArray__nHXaesL0DJZHyVS07ARPRA T2_; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); abc.len = 0; abc.p = NIM_NIL; abc = TM__SRd76hP9cMfCzdUO857UhQQ_3; rev__M33htTarT3MPij9aNZoCdAg((&abc)); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; T2_[0] = abc; echoBinSafe(T2_, 1); { LA1_:; } { eqdestroy___dS1BF3Vxjg9aJMmmhVJKSpQ((&abc)); } 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(); 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) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); main__EzBZaa239as9bFx8yeHDoTOw(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-09-19T02:37:59
  • Finished 2024-09-19T02:37:59
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( nnkInfix.newTree( newIdentNode("/"), newIdentNode("std"), newIdentNode("algorithm") ) ), nnkFuncDef.newTree( newIdentNode("rev"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode(), nnkIdentDefs.newTree( newIdentNode("s"), nnkVarTy.newTree( newIdentNode("string") ), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkDotExpr.newTree( newIdentNode("s"), newIdentNode("reverse") ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("abc"), newEmptyNode(), newLit("abc") ) ), nnkDotExpr.newTree( newIdentNode("abc"), newIdentNode("rev") ), nnkCommand.newTree( newIdentNode("echo"), newIdentNode("abc") ) ) ), nnkCall.newTree( newIdentNode("main") ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-09-19T02:37:04Z
  • Comments 3
  • Commands nim c --gc:arc -d:nimArcDebug -d:nimArcIds --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 25 mins bisecting 8 commits at 0 commits per second

metagn commented 1 month ago

reverse has a var openarray[T] overload which matches as openarray[char] for string, but this means the compiler doesn't know to insert prepareMutation. Maybe for conversions from string to var openarray it should always invoke prepareMutation?

Araq commented 1 month ago

I thought the codegen would already do that, so yes, that's what it should do.

ringabout commented 1 month ago

conversions from string to var openarray it should always invoke prepareMutation

It has already been done, but not var string -> var openArray

Araq commented 1 month ago

If it's var string already, why would it need prepareMutation when passed to var openarray?

ringabout commented 1 month ago

prepareMutation is not set up for var string as the parameter. Only bracket expressions and openarray conversions use nimPrepareStrMutationV2

proc foo(x: var string) =
  discard

var x = "123"
foo(x)
ringabout commented 1 month ago

If it's var string already, why would it need prepareMutation when passed to var openarray?

proc foo(x: var openArray[char]) =
  discard

var x = "123"
foo(x)

In this case, x is of type var string. The backend skips the nkHiddenAddr for x ad generates nimPrepareStrMutationV2. But it doesn't handle the case for a skParam with a var string type

proc bar(x: var openArray[char]) =
  discard

proc foo(x: var string) =
  bar(x)

var x = "123"
foo(x)
ringabout commented 1 month ago

The culprit seems to be that transf folds (addr (deref (param)) which is harmful to openArrayLoc