nim-lang / Nim

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

Thread var cannot be returned from a proc. Causing SIGSEV #23652

Open Alogani opened 5 months ago

Alogani commented 5 months ago

Description

Hello,

Apparently, it is not possible to create a thread var and return it from a proc. It causes a SIGSEV

import os

proc threadMain() {.thread.} =
    sleep(100000)

proc main(): Thread[void] =
    var th: Thread[void]
    createThread(th, threadMain)
    return th

var th = main()
joinThread(th)

Nim Version

nim v2.0.4 on Fedora

Current Output

No stack traceback available
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

No response

Possible Solution

No response

Additional Information

No response

github-actions[bot] commented 5 months ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 115.47 Kb (118,240 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ; typedef struct tyObject_GcThread__av9bjq4dDntjl22CvAy852g tyObject_GcThread__av9bjq4dDntjl22CvAy852g; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ { tyObject_GcThread__av9bjq4dDntjl22CvAy852g* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u51)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4963)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u14)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u17)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* dest_p0); static N_INLINE(void, joinThread__temp_u43)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ t_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); N_LIB_PRIVATE tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ th__temp_u36; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4747; extern NIM_THREADVAR TFrame* framePtr__system_u2655; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4747); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2655 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2655).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2655; framePtr__system_u2655 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4963(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2655 = (*framePtr__system_u2655).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI)100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ, main__temp_u3)(void) { tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ result; tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ)); createThread__stdZtypedthreads_u51((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; eqwasMoved___temp_u14((&th)); eqdestroy___temp_u17((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u17((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u43)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } 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) { { tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u36 = T1_; joinThread__temp_u43(th__temp_u36); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u17((&th__temp_u36)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:20
  • Finished 2024-05-30T13:30:22
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
stable :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 111.17 Kb (113,840 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA; typedef struct tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA { tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u51)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5035)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th__temp_u37; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4817; extern NIM_THREADVAR TFrame* framePtr__system_u4434; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4817); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4434 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4434).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4434; framePtr__system_u4434 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u5035(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4434 = (*framePtr__system_u4434).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI)100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void) { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA result; tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); createThread__stdZtypedthreads_u51((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; eqwasMoved___temp_u15((&th)); eqdestroy___temp_u18((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u18((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_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) { { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u37 = T1_; joinThread__temp_u45(th__temp_u37); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u18((&th__temp_u37)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:22
  • Finished 2024-05-30T13:30:23
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
2.0.4 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 111.17 Kb (113,840 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA; typedef struct tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA { tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u51)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5035)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th__temp_u37; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4817; extern NIM_THREADVAR TFrame* framePtr__system_u4434; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4817); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4434 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4434).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4434; framePtr__system_u4434 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u5035(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4434 = (*framePtr__system_u4434).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI)100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void) { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA result; tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); createThread__stdZtypedthreads_u51((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; eqwasMoved___temp_u15((&th)); eqdestroy___temp_u18((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u18((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } 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; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_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) { { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u37 = T1_; joinThread__temp_u45(th__temp_u37); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u18((&th__temp_u37)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:24
  • Finished 2024-05-30T13:30:25
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
2.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 111.17 Kb (113,840 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__UMuPLD9amU5lGntmXVXAngw tyObject_Thread__UMuPLD9amU5lGntmXVXAngw; typedef struct tyObject_GcThread__dE69bBzBMyygsowearNa6qw tyObject_GcThread__dE69bBzBMyygsowearNa6qw; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__UMuPLD9amU5lGntmXVXAngw { tyObject_GcThread__dE69bBzBMyygsowearNa6qw* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u51)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5021)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* dest_p0); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* dest_p0); static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw t_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); N_LIB_PRIVATE tyObject_Thread__UMuPLD9amU5lGntmXVXAngw th__temp_u37; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4803; extern NIM_THREADVAR TFrame* framePtr__system_u4420; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u4803); return result; } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u4420 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u4420).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u4420; framePtr__system_u4420 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u5021(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4420 = (*framePtr__system_u4420).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI)100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw, main__temp_u3)(void) { tyObject_Thread__UMuPLD9amU5lGntmXVXAngw result; tyObject_Thread__UMuPLD9amU5lGntmXVXAngw th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw)); createThread__stdZtypedthreads_u51((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; eqwasMoved___temp_u15((&th)); eqdestroy___temp_u18((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u18((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u45)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } 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) { { tyObject_Thread__UMuPLD9amU5lGntmXVXAngw T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u37 = T1_; joinThread__temp_u45(th__temp_u37); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; eqdestroy___temp_u18((&th__temp_u37)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:28
  • Finished 2024-05-30T13:30:29
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.6.20 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' fatal.nim(54) sysFatal Error: unhandled exception: options.nim(662, 14) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 101.16 Kb (103,584 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog tyObject_Thread__9aq6rc47aRRprkGRXb4uuog; typedef struct tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog { tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__system_u4737)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5472)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u15)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* dest); static N_INLINE(void, joinThread__temp_u36)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t); 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); N_LIB_PRIVATE tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th__temp_u28; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u5301; extern NIM_THREADVAR TFrame* framePtr__system_u4953; 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(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u5301); return result; } static N_INLINE(void, nimZeroMem)(void* p, NI size) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p, ((int) 0), size); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u4953 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u4953).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u4953; framePtr__system_u4953 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u5472(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4953 = (*framePtr__system_u4953).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI) 100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void) { tyObject_Thread__9aq6rc47aRRprkGRXb4uuog result; tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); createThread__system_u4737((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); eqdestroy___temp_u15((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u15((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u36)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, ((void**) NIM_NIL)); (void)(T1_); } 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) { { tyObject_Thread__9aq6rc47aRRprkGRXb4uuog T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u28 = T1_; joinThread__temp_u36(th__temp_u28); eqdestroy___temp_u15((&th__temp_u28)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:31
  • Finished 2024-05-30T13:30:32
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.4.8 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 /home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/bitmasks.nim(13, 3) Error: redefinition of 'PageShift'; previous declaration here: /home/runner/.choosenim/toolchains/nim-1.4.8/lib/system/bitmasks.nim(13, 3) ```

IR

Compiled filesize 101.16 Kb (103,584 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog tyObject_Thread__9aq6rc47aRRprkGRXb4uuog; typedef struct tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog { tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__system_u4737)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u5472)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u15)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* dest); static N_INLINE(void, joinThread__temp_u36)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t); 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); N_LIB_PRIVATE tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th__temp_u28; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u5301; extern NIM_THREADVAR TFrame* framePtr__system_u4953; 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(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__system_u5301); return result; } static N_INLINE(void, nimZeroMem)(void* p, NI size) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__systemZmemory_u7(p, ((int) 0), size); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u4953 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u4953).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u4953; framePtr__system_u4953 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u5472(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u4953 = (*framePtr__system_u4953).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI) 100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void) { tyObject_Thread__9aq6rc47aRRprkGRXb4uuog result; tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); createThread__system_u4737((&th), threadMain__temp_u2); if (NIM_UNLIKELY(*nimErr_)) goto LA1_; result = th; nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); eqdestroy___temp_u15((&th)); goto BeforeRet_; { LA1_:; } { eqdestroy___temp_u15((&th)); } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u36)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, ((void**) NIM_NIL)); (void)(T1_); } 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) { { tyObject_Thread__9aq6rc47aRRprkGRXb4uuog T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); T1_ = main__temp_u3(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__temp_u28 = T1_; joinThread__temp_u36(th__temp_u28); eqdestroy___temp_u15((&th__temp_u28)); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:35
  • Finished 2024-05-30T13:30:35
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.2.18 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 88.94 Kb (91,072 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg; typedef struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg { tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__um5slEgmxl6nQ1entEtXNw)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); 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, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t); 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, stdlib_timesInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th__9bq9cyZRLQIvZd49a8J9aFOZPA; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA); return result; } static N_INLINE(void, nimZeroMem)(void* p, NI size) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } 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, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI) 100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void) { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg result; tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); createThread__um5slEgmxl6nQ1entEtXNw((&th), threadMain__EzBZaa239as9bFx8yeHDoTOw); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; result = th; goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, NIM_NIL); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { } N_LIB_PRIVATE void PreMainInner(void) { stdlib_timesInit000(); } 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) { { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); T1_ = main__RDXi9cxjI1WGO8O9c2kM9cNcQ(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__9bq9cyZRLQIvZd49a8J9aFOZPA = T1_; joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem(th__9bq9cyZRLQIvZd49a8J9aFOZPA); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:37
  • Finished 2024-05-30T13:30:38
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.0.10 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:orc --threads:on -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 command line(1, 2) Error: 'none', 'boehm' or 'refc' expected, but 'orc' found ```

IR

Compiled filesize 88.94 Kb (91,072 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg; typedef struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg { tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, createThread__um5slEgmxl6nQ1entEtXNw)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); 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, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t); 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, stdlib_timesInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th__9bq9cyZRLQIvZd49a8J9aFOZPA; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__759bT87luu8XGcbkw13FUjA; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (NIM_BOOL*)0; result = (&nimInErrorMode__759bT87luu8XGcbkw13FUjA); return result; } static N_INLINE(void, nimZeroMem)(void* p, NI size) { NIM_BOOL* nimErr_; {nimErr_ = nimErrorFlag(); nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; } 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, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void) { NIM_BOOL* nimErr_; nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nossleep(((NI) 100000)); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; }BeforeRet_: ; popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void) { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg result; tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th; NIM_BOOL* nimErr_; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); {nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); createThread__um5slEgmxl6nQ1entEtXNw((&th), threadMain__EzBZaa239as9bFx8yeHDoTOw); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; result = th; goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, NIM_NIL); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { } N_LIB_PRIVATE void PreMainInner(void) { stdlib_timesInit000(); } 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) { { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg T1_; NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); nimZeroMem((void*)(&T1_), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); T1_ = main__RDXi9cxjI1WGO8O9c2kM9cNcQ(); if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; th__9bq9cyZRLQIvZd49a8J9aFOZPA = T1_; joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem(th__9bq9cyZRLQIvZd49a8J9aFOZPA); BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:30:40
  • Finished 2024-05-30T13:30:40
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.3
  • Created 2024-05-30T13:29:53Z
  • Comments 1
  • Commands nim c --gc:orc --threads:on -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 23 minutes bisecting 8 commits at 0 commits per second

juancarlospaco commented 5 months ago

!nim c --gc:refc --threads:on

import os

proc threadMain() {.thread.} =
    sleep(100000)

proc main(): Thread[void] =
    var th: Thread[void]
    createThread(th, threadMain)
    return th

var th = main()
joinThread(th)
github-actions[bot] commented 5 months ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: errGenerated [AssertionDefect] ```

IR

Compiled filesize 113.77 Kb (116,504 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ; typedef struct tyObject_GcThread__av9bjq4dDntjl22CvAy852g tyObject_GcThread__av9bjq4dDntjl22CvAy852g; typedef struct Exception Exception; typedef struct RootObj RootObj; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct tySequence__9bNRJkU9cJnNkESCDTQ7DgcQ tySequence__9bNRJkU9cJnNkESCDTQ7DgcQ; typedef struct TSafePoint TSafePoint; typedef struct tyObject_StackTraceEntry__2Xjg6E7TZG7p9bcgUNTKHrg tyObject_StackTraceEntry__2Xjg6E7TZG7p9bcgUNTKHrg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ { tyObject_GcThread__av9bjq4dDntjl22CvAy852g* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; typedef NU8 tyEnum_TNimKind__ClA3xuAkmIebTG0trkhp7w; typedef NU8 tySet_tyEnum_TNimTypeFlag__lkZ7PEzlp5IUJlUpsPWkog; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p_p0, NI op_p1); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p_p0); struct TNimType { NI size; NI align; tyEnum_TNimKind__ClA3xuAkmIebTG0trkhp7w kind; tySet_tyEnum_TNimTypeFlag__lkZ7PEzlp5IUJlUpsPWkog flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; struct RootObj { TNimType* m_type; }; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct Exception { RootObj Sup; Exception* parent; NCSTRING name; NimStringDesc* message; tySequence__9bNRJkU9cJnNkESCDTQ7DgcQ* trace; Exception* up; }; typedef long tyArray__YIYg2AHg0wu0su59avGYMLQ[25]; struct TSafePoint { TSafePoint* prev; NI status; jmp_buf context; }; struct tyObject_StackTraceEntry__2Xjg6E7TZG7p9bcgUNTKHrg { NCSTRING procname; NI line; NCSTRING filename; }; struct tySequence__9bNRJkU9cJnNkESCDTQ7DgcQ { TGenericSeq Sup; tyObject_StackTraceEntry__2Xjg6E7TZG7p9bcgUNTKHrg data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u50)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3132)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u14)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* dest_p0); static N_INLINE(void, popSafePoint)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u17)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ* dest_p0); static N_INLINE(TFrame*, getFrame)(void); static N_INLINE(void, setFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void); N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void); static N_INLINE(void, joinThread__temp_u40)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ t_p0); static N_INLINE(void, initStackBottomWith)(void* locals_p0); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatspureatstimesdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatspureatstimesdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ th__temp_u33; extern NIM_THREADVAR TSafePoint* excHandler__system_u2608; extern NIM_THREADVAR TFrame* framePtr__system_u2606; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); } static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0) { (*s_p0).prev = excHandler__system_u2608; excHandler__system_u2608 = s_p0; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2606 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2606).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2606; framePtr__system_u2606 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u3132(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2606 = (*framePtr__system_u2606).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI)100000)); popFrame(); } static N_INLINE(void, popSafePoint)(void) { excHandler__system_u2608 = (*excHandler__system_u2608).prev; } static N_INLINE(TFrame*, getFrame)(void) { TFrame* result; result = (TFrame*)0; result = framePtr__system_u2606; return result; } static N_INLINE(void, setFrame)(TFrame* s_p0) { framePtr__system_u2606 = s_p0; } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ, main__temp_u3)(void) { tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ result; tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ th; TSafePoint TM__SRd76hP9cMfCzdUO857UhQQ_2; TFrame* _nimCurFrame; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { _nimCurFrame = getFrame(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ)); pushSafePoint(&TM__SRd76hP9cMfCzdUO857UhQQ_2); TM__SRd76hP9cMfCzdUO857UhQQ_2.status = setjmp(TM__SRd76hP9cMfCzdUO857UhQQ_2.context); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status == 0) { createThread__stdZtypedthreads_u50((&th), threadMain__temp_u2); result = th; eqwasMoved___temp_u14((&th)); popSafePoint(); eqdestroy___temp_u17((&th)); goto BeforeRet_; popSafePoint(); } else { popSafePoint(); setFrame(_nimCurFrame); } { eqdestroy___temp_u17((&th)); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) nimLeaveFinally(); } if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) reraiseException(); }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u40)(tyObject_Thread__PyRAMdC9bk9an9ab80VGZBb9cQ t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals_p0) { nimGC_setStackBottom(locals_p0); } N_LIB_PRIVATE void PreMainInner(void) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatspureatstimesdotnim_Init000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 1 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatspureatstimesdotnim_DatInit000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatspureatstimesdotnim_DatInit000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 1 void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); #else PreMain(); initStackBottomWith((void *)&inner); 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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); th__temp_u33 = main__temp_u3(); joinThread__temp_u40(th__temp_u33); eqdestroy___temp_u17((&th__temp_u33)); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:31
  • Finished 2024-05-30T13:36:32
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
stable :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 113.76 Kb (116,488 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA; typedef struct tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg; typedef struct Exception Exception; typedef struct RootObj RootObj; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ; typedef struct TSafePoint TSafePoint; typedef struct tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA { tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; typedef NU8 tyEnum_TNimKind__JQqVBAuFUw8A9ajP89ctnUCw; typedef NU8 tySet_tyEnum_TNimTypeFlag__w2BCt56S3PAfbHf8acLiVA; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p_p0, NI op_p1); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p_p0); struct TNimType { NI size; NI align; tyEnum_TNimKind__JQqVBAuFUw8A9ajP89ctnUCw kind; tySet_tyEnum_TNimTypeFlag__w2BCt56S3PAfbHf8acLiVA flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; struct RootObj { TNimType* m_type; }; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct Exception { RootObj Sup; Exception* parent; NCSTRING name; NimStringDesc* message; tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ* trace; Exception* up; }; typedef long tyArray__YIYg2AHg0wu0su59avGYMLQ[25]; struct TSafePoint { TSafePoint* prev; NI status; jmp_buf context; }; struct tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ { NCSTRING procname; NI line; NCSTRING filename; }; struct tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ { TGenericSeq Sup; tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u50)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3134)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(void, popSafePoint)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(TFrame*, getFrame)(void); static N_INLINE(void, setFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void); N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void); static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0); static N_INLINE(void, initStackBottomWith)(void* locals_p0); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th__temp_u34; extern NIM_THREADVAR TSafePoint* excHandler__system_u2602; extern NIM_THREADVAR TFrame* framePtr__system_u2601; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); } static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0) { (*s_p0).prev = excHandler__system_u2602; excHandler__system_u2602 = s_p0; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2601; framePtr__system_u2601 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u3134(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2601 = (*framePtr__system_u2601).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI)100000)); popFrame(); } static N_INLINE(void, popSafePoint)(void) { excHandler__system_u2602 = (*excHandler__system_u2602).prev; } static N_INLINE(TFrame*, getFrame)(void) { TFrame* result; result = (TFrame*)0; result = framePtr__system_u2601; return result; } static N_INLINE(void, setFrame)(TFrame* s_p0) { framePtr__system_u2601 = s_p0; } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void) { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA result; tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th; TSafePoint TM__SRd76hP9cMfCzdUO857UhQQ_2; TFrame* _nimCurFrame; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { _nimCurFrame = getFrame(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); pushSafePoint(&TM__SRd76hP9cMfCzdUO857UhQQ_2); TM__SRd76hP9cMfCzdUO857UhQQ_2.status = setjmp(TM__SRd76hP9cMfCzdUO857UhQQ_2.context); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status == 0) { createThread__stdZtypedthreads_u50((&th), threadMain__temp_u2); result = th; eqwasMoved___temp_u15((&th)); popSafePoint(); eqdestroy___temp_u18((&th)); goto BeforeRet_; popSafePoint(); } else { popSafePoint(); setFrame(_nimCurFrame); } { eqdestroy___temp_u18((&th)); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) nimLeaveFinally(); } if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) reraiseException(); }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals_p0) { nimGC_setStackBottom(locals_p0); } N_LIB_PRIVATE void PreMainInner(void) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_Init000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 1 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 1 void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); #else PreMain(); initStackBottomWith((void *)&inner); 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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); th__temp_u34 = main__temp_u3(); joinThread__temp_u42(th__temp_u34); eqdestroy___temp_u18((&th__temp_u34)); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:33
  • Finished 2024-05-30T13:36:34
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
2.0.4 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 113.76 Kb (116,488 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA; typedef struct tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg; typedef struct Exception Exception; typedef struct RootObj RootObj; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ; typedef struct TSafePoint TSafePoint; typedef struct tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA { tyObject_GcThread__oSodRSnhqPhGgLYjjaK9bhg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; typedef NU8 tyEnum_TNimKind__JQqVBAuFUw8A9ajP89ctnUCw; typedef NU8 tySet_tyEnum_TNimTypeFlag__w2BCt56S3PAfbHf8acLiVA; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p_p0, NI op_p1); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p_p0); struct TNimType { NI size; NI align; tyEnum_TNimKind__JQqVBAuFUw8A9ajP89ctnUCw kind; tySet_tyEnum_TNimTypeFlag__w2BCt56S3PAfbHf8acLiVA flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; struct RootObj { TNimType* m_type; }; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct Exception { RootObj Sup; Exception* parent; NCSTRING name; NimStringDesc* message; tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ* trace; Exception* up; }; typedef long tyArray__YIYg2AHg0wu0su59avGYMLQ[25]; struct TSafePoint { TSafePoint* prev; NI status; jmp_buf context; }; struct tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ { NCSTRING procname; NI line; NCSTRING filename; }; struct tySequence__W5u7dtuXI9c4BOBf9bW9bZhWQ { TGenericSeq Sup; tyObject_StackTraceEntry__6CL1lcV9bxEp7TPS0fN8sRQ data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u50)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3134)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(void, popSafePoint)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA* dest_p0); static N_INLINE(TFrame*, getFrame)(void); static N_INLINE(void, setFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void); N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void); static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0); static N_INLINE(void, initStackBottomWith)(void* locals_p0); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th__temp_u34; extern NIM_THREADVAR TSafePoint* excHandler__system_u2602; extern NIM_THREADVAR TFrame* framePtr__system_u2601; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); } static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0) { (*s_p0).prev = excHandler__system_u2602; excHandler__system_u2602 = s_p0; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2601; framePtr__system_u2601 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u3134(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2601 = (*framePtr__system_u2601).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI)100000)); popFrame(); } static N_INLINE(void, popSafePoint)(void) { excHandler__system_u2602 = (*excHandler__system_u2602).prev; } static N_INLINE(TFrame*, getFrame)(void) { TFrame* result; result = (TFrame*)0; result = framePtr__system_u2601; return result; } static N_INLINE(void, setFrame)(TFrame* s_p0) { framePtr__system_u2601 = s_p0; } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA, main__temp_u3)(void) { tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA result; tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA th; TSafePoint TM__SRd76hP9cMfCzdUO857UhQQ_2; TFrame* _nimCurFrame; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { _nimCurFrame = getFrame(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA)); pushSafePoint(&TM__SRd76hP9cMfCzdUO857UhQQ_2); TM__SRd76hP9cMfCzdUO857UhQQ_2.status = setjmp(TM__SRd76hP9cMfCzdUO857UhQQ_2.context); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status == 0) { createThread__stdZtypedthreads_u50((&th), threadMain__temp_u2); result = th; eqwasMoved___temp_u15((&th)); popSafePoint(); eqdestroy___temp_u18((&th)); goto BeforeRet_; popSafePoint(); } else { popSafePoint(); setFrame(_nimCurFrame); } { eqdestroy___temp_u18((&th)); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) nimLeaveFinally(); } if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) reraiseException(); }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__CdP5XLL5FgX5y7Zm73uvfA t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals_p0) { nimGC_setStackBottom(locals_p0); } N_LIB_PRIVATE void PreMainInner(void) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_Init000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 1 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatspureatstimesdotnim_DatInit000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 1 void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); #else PreMain(); initStackBottomWith((void *)&inner); 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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); th__temp_u34 = main__temp_u3(); joinThread__temp_u42(th__temp_u34); eqdestroy___temp_u18((&th__temp_u34)); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:34
  • Finished 2024-05-30T13:36:35
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
2.0.0 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 command line(1, 2) Warning: `gc:option` is deprecated; use `mm:option` instead [Deprecated] No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp' assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 113.76 Kb (116,488 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #include #define _GNU_SOURCE #include #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__UMuPLD9amU5lGntmXVXAngw tyObject_Thread__UMuPLD9amU5lGntmXVXAngw; typedef struct tyObject_GcThread__dE69bBzBMyygsowearNa6qw tyObject_GcThread__dE69bBzBMyygsowearNa6qw; typedef struct Exception Exception; typedef struct RootObj RootObj; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct tySequence__2ALwPJKv8Nz8mMm4Hy9crdw tySequence__2ALwPJKv8Nz8mMm4Hy9crdw; typedef struct TSafePoint TSafePoint; typedef struct tyObject_StackTraceEntry__nOjYJiLBbFH64nNmW1UArA tyObject_StackTraceEntry__nOjYJiLBbFH64nNmW1UArA; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__UMuPLD9amU5lGntmXVXAngw { tyObject_GcThread__dE69bBzBMyygsowearNa6qw* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; typedef NU8 tyEnum_TNimKind__gvi1epwSO1OTm5TYYpvciQ; typedef NU8 tySet_tyEnum_TNimTypeFlag__kg8CbOmSm78f9cYZNYwXtRw; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p_p0, NI op_p1); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p_p0); struct TNimType { NI size; NI align; tyEnum_TNimKind__gvi1epwSO1OTm5TYYpvciQ kind; tySet_tyEnum_TNimTypeFlag__kg8CbOmSm78f9cYZNYwXtRw flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; struct RootObj { TNimType* m_type; }; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct Exception { RootObj Sup; Exception* parent; NCSTRING name; NimStringDesc* message; tySequence__2ALwPJKv8Nz8mMm4Hy9crdw* trace; Exception* up; }; typedef long tyArray__YIYg2AHg0wu0su59avGYMLQ[25]; struct TSafePoint { TSafePoint* prev; NI status; jmp_buf context; }; struct tyObject_StackTraceEntry__nOjYJiLBbFH64nNmW1UArA { NCSTRING procname; NI line; NCSTRING filename; }; struct tySequence__2ALwPJKv8Nz8mMm4Hy9crdw { TGenericSeq Sup; tyObject_StackTraceEntry__nOjYJiLBbFH64nNmW1UArA data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2); static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0); N_LIB_PRIVATE N_NIMCALL(void, createThread__stdZtypedthreads_u50)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* t_p0, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp_p1); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs_p0); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3134)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, eqwasMoved___temp_u15)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* dest_p0); static N_INLINE(void, popSafePoint)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u18)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw* dest_p0); static N_INLINE(TFrame*, getFrame)(void); static N_INLINE(void, setFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void); N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void); static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw t_p0); static N_INLINE(void, initStackBottomWith)(void* locals_p0); N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatspureatstimesdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatspureatstimesdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__UMuPLD9amU5lGntmXVXAngw th__temp_u34; extern NIM_THREADVAR TSafePoint* excHandler__system_u2602; extern NIM_THREADVAR TFrame* framePtr__system_u2601; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) { void* T1_; T1_ = (void*)0; T1_ = memset(a_p0, v_p1, ((size_t) (size_p2))); } static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) { nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1); } static N_INLINE(void, pushSafePoint)(TSafePoint* s_p0) { (*s_p0).prev = excHandler__system_u2602; excHandler__system_u2602 = s_p0; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2601; framePtr__system_u2601 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u3134(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2601 = (*framePtr__system_u2601).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI)100000)); popFrame(); } static N_INLINE(void, popSafePoint)(void) { excHandler__system_u2602 = (*excHandler__system_u2602).prev; } static N_INLINE(TFrame*, getFrame)(void) { TFrame* result; result = (TFrame*)0; result = framePtr__system_u2601; return result; } static N_INLINE(void, setFrame)(TFrame* s_p0) { framePtr__system_u2601 = s_p0; } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw, main__temp_u3)(void) { tyObject_Thread__UMuPLD9amU5lGntmXVXAngw result; tyObject_Thread__UMuPLD9amU5lGntmXVXAngw th; TSafePoint TM__SRd76hP9cMfCzdUO857UhQQ_2; TFrame* _nimCurFrame; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { _nimCurFrame = getFrame(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw)); pushSafePoint(&TM__SRd76hP9cMfCzdUO857UhQQ_2); TM__SRd76hP9cMfCzdUO857UhQQ_2.status = setjmp(TM__SRd76hP9cMfCzdUO857UhQQ_2.context); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status == 0) { createThread__stdZtypedthreads_u50((&th), threadMain__temp_u2); result = th; eqwasMoved___temp_u15((&th)); popSafePoint(); eqdestroy___temp_u18((&th)); goto BeforeRet_; popSafePoint(); } else { popSafePoint(); setFrame(_nimCurFrame); } { eqdestroy___temp_u18((&th)); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) nimLeaveFinally(); } if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) reraiseException(); }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u42)(tyObject_Thread__UMuPLD9amU5lGntmXVXAngw t_p0) { int T1_; T1_ = (int)0; T1_ = pthread_join(t_p0.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals_p0) { nimGC_setStackBottom(locals_p0); } N_LIB_PRIVATE void PreMainInner(void) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatspureatstimesdotnim_Init000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { #if 1 void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatspureatstimesdotnim_DatInit000(); (*inner)(); #else atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatspureatstimesdotnim_DatInit000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 1 void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); #else PreMain(); initStackBottomWith((void *)&inner); 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) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); th__temp_u34 = main__temp_u3(); joinThread__temp_u42(th__temp_u34); eqdestroy___temp_u18((&th__temp_u34)); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:38
  • Finished 2024-05-30T13:36:39
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.6.20 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Segmentation fault (core dumped) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' fatal.nim(54) sysFatal Error: unhandled exception: options.nim(662, 14) `false` errGenerated [AssertionDefect] ```

IR

Compiled filesize 112.41 Kb (115,112 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog tyObject_Thread__9aq6rc47aRRprkGRXb4uuog; typedef struct tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ; typedef struct Exception Exception; typedef struct RootObj RootObj; typedef struct TNimType TNimType; typedef struct TNimNode TNimNode; typedef struct NimStringDesc NimStringDesc; typedef struct TGenericSeq TGenericSeq; typedef struct tySequence__5ppf27xNiC9aiXSPX0PMgHg tySequence__5ppf27xNiC9aiXSPX0PMgHg; typedef struct TSafePoint TSafePoint; typedef struct tyObject_StackTraceEntry__bbVZPBZtf49abwlWtZZfyvQ tyObject_StackTraceEntry__bbVZPBZtf49abwlWtZZfyvQ; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__9aq6rc47aRRprkGRXb4uuog { tyObject_GcThread__4KEbVXllcUVyNiEC1lkYRQ* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; typedef NU8 tyEnum_TNimKind__b9brdfAMvuT12kv1MtmF3IQ; typedef NU8 tySet_tyEnum_TNimTypeFlag__h29aLKtZInAIaLqhWRujWcA; typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op); typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p); struct TNimType { NI size; NI align; tyEnum_TNimKind__b9brdfAMvuT12kv1MtmF3IQ kind; tySet_tyEnum_TNimTypeFlag__h29aLKtZInAIaLqhWRujWcA flags; TNimType* base; TNimNode* node; void* finalizer; tyProc__ojoeKfW4VYIm36I9cpDTQIg marker; tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy; }; struct RootObj { TNimType* m_type; }; struct TGenericSeq { NI len; NI reserved; }; struct NimStringDesc { TGenericSeq Sup; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct Exception { RootObj Sup; Exception* parent; NCSTRING name; NimStringDesc* message; tySequence__5ppf27xNiC9aiXSPX0PMgHg* trace; Exception* up; }; typedef long tyArray__TcvIiMAJvcwzNLsZkfnFnQ[25]; struct TSafePoint { TSafePoint* prev; NI status; jmp_buf context; }; struct tyObject_StackTraceEntry__bbVZPBZtf49abwlWtZZfyvQ { NCSTRING procname; NI line; NCSTRING filename; }; struct tySequence__5ppf27xNiC9aiXSPX0PMgHg { TGenericSeq Sup; tyObject_StackTraceEntry__bbVZPBZtf49abwlWtZZfyvQ data[SEQ_DECL_SIZE]; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void); static N_INLINE(void, nimZeroMem)(void* p, NI size); static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size); static N_INLINE(void, pushSafePoint)(TSafePoint* s); N_LIB_PRIVATE N_NIMCALL(void, createThread__system_u2913)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); static N_INLINE(void, nimFrame)(TFrame* s); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3532)(void); static N_INLINE(void, popFrame)(void); static N_INLINE(void, popSafePoint)(void); N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u15)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog* dest); static N_INLINE(TFrame*, getFrame)(void); static N_INLINE(void, setFrame)(TFrame* s); N_LIB_PRIVATE N_NIMCALL(void, nimLeaveFinally)(void); N_LIB_PRIVATE N_NIMCALL(void, reraiseException)(void); static N_INLINE(void, joinThread__temp_u33)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t); 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, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_DatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th__temp_u25; extern NIM_THREADVAR TSafePoint* excHandler__system_u3100; extern NIM_THREADVAR TFrame* framePtr__system_u3099; static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__systemZmemory_u7(p, ((int) 0), size); } static N_INLINE(void, pushSafePoint)(TSafePoint* s) { (*s).prev = excHandler__system_u3100; excHandler__system_u3100 = s; } static N_INLINE(void, nimFrame)(TFrame* s) { { if (!(framePtr__system_u3099 == ((TFrame*) NIM_NIL))) goto LA3_; (*s).calldepth = ((NI16) 0); } goto LA1_; LA3_: ; { (*s).calldepth = (NI16)((*framePtr__system_u3099).calldepth + ((NI16) 1)); } LA1_: ; (*s).prev = framePtr__system_u3099; framePtr__system_u3099 = s; { if (!((*s).calldepth == ((NI16) 2000))) goto LA8_; callDepthLimitReached__system_u3532(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u3099 = (*framePtr__system_u3099).prev; } N_LIB_PRIVATE N_NIMCALL(void, threadMain__temp_u2)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI) 100000)); popFrame(); } static N_INLINE(void, popSafePoint)(void) { excHandler__system_u3100 = (*excHandler__system_u3100).prev; } static N_INLINE(TFrame*, getFrame)(void) { TFrame* result; result = (TFrame*)0; result = framePtr__system_u3099; return result; } static N_INLINE(void, setFrame)(TFrame* s) { framePtr__system_u3099 = s; } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog, main__temp_u3)(void) { tyObject_Thread__9aq6rc47aRRprkGRXb4uuog result; tyObject_Thread__9aq6rc47aRRprkGRXb4uuog th; TSafePoint TM__SRd76hP9cMfCzdUO857UhQQ_2; TFrame* _nimCurFrame; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { _nimCurFrame = getFrame(); nimZeroMem((void*)(&result), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); pushSafePoint(&TM__SRd76hP9cMfCzdUO857UhQQ_2); TM__SRd76hP9cMfCzdUO857UhQQ_2.status = setjmp(TM__SRd76hP9cMfCzdUO857UhQQ_2.context); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status == 0) { createThread__system_u2913((&th), threadMain__temp_u2); result = th; nimZeroMem((void*)(&th), sizeof(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog)); popSafePoint(); eqdestroy___temp_u15((&th)); goto BeforeRet_; popSafePoint(); } else { popSafePoint(); setFrame(_nimCurFrame); } { eqdestroy___temp_u15((&th)); if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) nimLeaveFinally(); } if (TM__SRd76hP9cMfCzdUO857UhQQ_2.status != 0) reraiseException(); }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__temp_u33)(tyObject_Thread__9aq6rc47aRRprkGRXb4uuog t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_Init000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000(); initStackBottomWith((void *)&inner); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000(); atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatspureatstimesdotnim_DatInit000(); (*inner)(); } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { void (*volatile inner)(void); PreMain(); inner = NimMainInner; initStackBottomWith((void *)&inner); (*inner)(); } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); th__temp_u25 = main__temp_u3(); joinThread__temp_u33(th__temp_u25); eqdestroy___temp_u15((&th__temp_u25)); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:42
  • Finished 2024-05-30T13:36:43
  • Duration 1 minutes

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.4.8 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 108.41 Kb (111,016 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg; typedef struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg { tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(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, createThread__um5slEgmxl6nQ1entEtXNw)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); 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, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t); 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, stdlib_timesDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th__9bq9cyZRLQIvZd49a8J9aFOZPA; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, 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, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI) 100000)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void) { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg result; tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { nimZeroMem((void*)(&result), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); createThread__um5slEgmxl6nQ1entEtXNw((&th), threadMain__EzBZaa239as9bFx8yeHDoTOw); result = th; goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, ((void**) NIM_NIL)); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { stdlib_timesInit000(); stdlib_osInit000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); stdlib_timesDatInit000(); stdlib_osDatInit000(); (*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"); th__9bq9cyZRLQIvZd49a8J9aFOZPA = main__RDXi9cxjI1WGO8O9c2kM9cNcQ(); joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem(th__9bq9cyZRLQIvZd49a8J9aFOZPA); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:46
  • Finished 2024-05-30T13:36:46
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.2.18 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 108.16 Kb (110,760 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg; typedef struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg { tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(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, createThread__um5slEgmxl6nQ1entEtXNw)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); 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, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t); 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, stdlib_timesDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th__9bq9cyZRLQIvZd49a8J9aFOZPA; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, 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, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI) 100000)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void) { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg result; tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { nimZeroMem((void*)(&result), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); createThread__um5slEgmxl6nQ1entEtXNw((&th), threadMain__EzBZaa239as9bFx8yeHDoTOw); result = th; goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, NIM_NIL); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } N_LIB_PRIVATE void PreMainInner(void) { stdlib_timesInit000(); stdlib_osInit000(); } N_LIB_PRIVATE int cmdCount; N_LIB_PRIVATE char** cmdLine; N_LIB_PRIVATE char** gEnv; N_LIB_PRIVATE void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); stdlib_timesDatInit000(); stdlib_osDatInit000(); (*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"); th__9bq9cyZRLQIvZd49a8J9aFOZPA = main__RDXi9cxjI1WGO8O9c2kM9cNcQ(); joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem(th__9bq9cyZRLQIvZd49a8J9aFOZPA); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:49
  • Finished 2024-05-30T13:36:50
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
1.0.10 :-1: FAIL

Output

``` Error: Command failed: nim c --gc:refc --threads:on --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 No stack traceback available SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: '/home/runner/work/Nim/Nim/temp ' ```

IR

Compiled filesize 99.05 Kb (101,424 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #include #include #define _GNU_SOURCE #include # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg; typedef struct tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg; typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void); struct tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg { tyObject_GcThread__hgJQSlfXDOK3SwSHjeZBXg* core; unsigned long sys; tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ dataFn; }; N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(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, createThread__um5slEgmxl6nQ1entEtXNw)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg* t, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ tp); N_LIB_PRIVATE N_NIMCALL(void, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void); N_LIB_PRIVATE N_NIMCALL(void, nossleep)(NI milsecs); 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, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t); 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, stdlib_timesDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_timesInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osDatInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, stdlib_osInit000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th__9bq9cyZRLQIvZd49a8J9aFOZPA; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; extern NIM_THREADVAR TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw; static N_INLINE(void, nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory)(void* a, int v, NI size) { void* T1_; T1_ = (void*)0; T1_ = memset(a, v, ((size_t) (size))); } static N_INLINE(void, nimZeroMem)(void* p, NI size) { nimSetMem__zxfKBYntu9cBapkhrCOk1fgmemory(p, ((int) 0), size); } static N_INLINE(void, 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, threadMain__EzBZaa239as9bFx8yeHDoTOw)(void) { nimfr_("threadMain", "/home/runner/work/Nim/Nim/temp.nim"); nossleep(((NI) 100000)); popFrame(); } N_LIB_PRIVATE N_NIMCALL(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg, main__RDXi9cxjI1WGO8O9c2kM9cNcQ)(void) { tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg result; tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg th; nimfr_("main", "/home/runner/work/Nim/Nim/temp.nim"); { nimZeroMem((void*)(&result), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); nimZeroMem((void*)(&th), sizeof(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg)); createThread__um5slEgmxl6nQ1entEtXNw((&th), threadMain__EzBZaa239as9bFx8yeHDoTOw); result = th; goto BeforeRet_; }BeforeRet_: ; popFrame(); return result; } static N_INLINE(void, joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem)(tyObject_Thread__YRlh9cu9aRh0NFPkIQ9arDrLg t) { int T1_; T1_ = (int)0; T1_ = pthread_join(t.sys, NIM_NIL); (void)(T1_); } static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals); } void PreMainInner(void) { stdlib_timesInit000(); stdlib_osInit000(); } int cmdCount; char** cmdLine; char** gEnv; void PreMain(void) { void (*volatile inner)(void); inner = PreMainInner; systemDatInit000(); initStackBottomWith((void *)&inner); systemInit000(); stdlib_timesDatInit000(); stdlib_osDatInit000(); (*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"); th__9bq9cyZRLQIvZd49a8J9aFOZPA = main__RDXi9cxjI1WGO8O9c2kM9cNcQ(); joinThread__7D7AwDmpXtzT3oBp9c4SUzwsystem(th__9bq9cyZRLQIvZd49a8J9aFOZPA); popFrame(); } } ```

Stats

  • Started 2024-05-30T13:36:52
  • Finished 2024-05-30T13:36:52
  • Duration

AST

```nim nnkStmtList.newTree( nnkImportStmt.newTree( newIdentNode("os") ), nnkProcDef.newTree( newIdentNode("threadMain"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( newEmptyNode() ), nnkPragma.newTree( newIdentNode("thread") ), newEmptyNode(), nnkStmtList.newTree( nnkCall.newTree( newIdentNode("sleep"), newLit(100000) ) ) ), nnkProcDef.newTree( newIdentNode("main"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), nnkBracketExpr.newTree( newIdentNode("Thread"), newIdentNode("void") ), newEmptyNode() ) ), nnkCall.newTree( newIdentNode("createThread"), newIdentNode("th"), newIdentNode("threadMain") ), nnkReturnStmt.newTree( newIdentNode("th") ) ) ), nnkVarSection.newTree( nnkIdentDefs.newTree( newIdentNode("th"), newEmptyNode(), nnkCall.newTree( newIdentNode("main") ) ) ), nnkCall.newTree( newIdentNode("joinThread"), newIdentNode("th") ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.3
  • Created 2024-05-30T13:36:01Z
  • Comments 2
  • Commands nim c --gc:refc --threads:on --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 minutes bisecting 8 commits at 0 commits per second

juancarlospaco commented 5 months ago

Same behaviour from 1.0 to devel, with ORC and refc.

metagn commented 1 week ago

Likely related is #24094. The thread address is not supposed to escape during the thread's lifetime. I'm not sure if this is supported but you can do something like:

import os

proc threadMain() {.thread.} =
    sleep(1000)

proc main(): ref Thread[void] =
    new(result)
    createThread(result[], threadMain)

var th = main()
joinThread(th[])
echo "abc"