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

iterator lent codegen error #17523

Open ringabout opened 3 years ago

ringabout commented 3 years ago
iterator hello(x: int): lent int =
  yield x

for i in hello(12):
  echo i
error: lvalue required as unary '&' operand
   i__fHkUd8GI567EsGOsPkB2Sg = (&((NI) 12));

compile?

ringabout commented 1 month ago

!nim c

iterator hello(x: int): lent int =
  yield x

for i in hello(12):
  echo i
github-actions[bot] commented 1 month ago
:penguin: Linux bisect by @ringabout (member)
devel :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:09
  • Finished 2024-10-13T11:19:09
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
stable :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:10
  • Finished 2024-10-13T11:19:10
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
2.0.10 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:11
  • Finished 2024-10-13T11:19:11
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
2.0.0 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:11
  • Finished 2024-10-13T11:19:12
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
1.6.20 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:12
  • Finished 2024-10-13T11:19:13
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
1.4.8 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:13
  • Finished 2024-10-13T11:19:13
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
1.2.18 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:14
  • Finished 2024-10-13T11:19:14
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
1.0.10 :-1: FAIL

Output

``` ```

IR

Compiled filesize 0 (0 bytes) ```cpp #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct NimStrPayload NimStrPayload; typedef struct NimStringV2 NimStringV2; struct NimStrPayload { NI cap; NIM_CHAR data[SEQ_DECL_SIZE]; }; struct NimStringV2 { NI len; NimStrPayload* p; }; typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1]; N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___systemZdollars_u8)(NI x_p0); N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0); N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0); static N_INLINE(NIM_BOOL*, nimErrorFlag)(void); N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void); static N_INLINE(void, nimFrame)(TFrame* s_p0); N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4655)(void); static N_INLINE(void, popFrame)(void); N_LIB_PRIVATE N_NIMCALL(void, atmdotnim_runtimeatslibatssystemdotnim_Init000)(void); N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void); N_LIB_PRIVATE NI* i__temp_u3; extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4437; extern NIM_THREADVAR TFrame* framePtr__system_u2669; static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) { NIM_BOOL* result; result = (&nimInErrorMode__system_u4437); return result; } static N_INLINE(void, nimFrame)(TFrame* s_p0) { { if (!(framePtr__system_u2669 == ((TFrame*) NIM_NIL))) goto LA3_; (*s_p0).calldepth = ((NI16)0); } goto LA1_; LA3_: ; { (*s_p0).calldepth = (NI16)((*framePtr__system_u2669).calldepth + ((NI16)1)); } LA1_: ; (*s_p0).prev = framePtr__system_u2669; framePtr__system_u2669 = s_p0; { if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_; callDepthLimitReached__system_u4655(); } LA8_: ; } static N_INLINE(void, popFrame)(void) { framePtr__system_u2669 = (*framePtr__system_u2669).prev; } N_LIB_PRIVATE 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; atmdotnim_runtimeatslibatssystemdotnim_Init000(); (*inner)(); #else atmdotnim_runtimeatslibatssystemdotnim_Init000(); PreMainInner(); #endif } N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) { NimMainModule(); } N_CDECL(void, NimMain)(void) { #if 0 void (*volatile inner)(void); PreMain(); inner = NimMainInner; (*inner)(); #else PreMain(); NimMainInner(); #endif } int main(int argc, char** args, char** env) { cmdLine = args; cmdCount = argc; gEnv = env; NimMain(); return nim_program_result; } N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) { { NIM_BOOL* nimErr_; nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim"); nimErr_ = nimErrorFlag(); { NimStringV2 colontmpD_; tyArray__nHXaesL0DJZHyVS07ARPRA T3_; colontmpD_.len = 0; colontmpD_.p = NIM_NIL; i__temp_u3 = (&((NI)12)); colontmpD_ = dollar___systemZdollars_u8((*i__temp_u3)); if (NIM_UNLIKELY(*nimErr_)) goto LA2_; T3_[0] = colontmpD_; echoBinSafe(T3_, 1); { LA2_:; } { if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) { deallocShared(colontmpD_.p); } } if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_; } BeforeRet_: ; nimTestErrorFlag(); popFrame(); } } ```

Stats

  • Started 2024-10-13T11:19:14
  • Finished 2024-10-13T11:19:15
  • Duration

AST

```nim nnkStmtList.newTree( nnkIteratorDef.newTree( newIdentNode("hello"), newEmptyNode(), newEmptyNode(), nnkFormalParams.newTree( nnkCommand.newTree( newIdentNode("lent"), newIdentNode("int") ), nnkIdentDefs.newTree( newIdentNode("x"), newIdentNode("int"), newEmptyNode() ) ), newEmptyNode(), newEmptyNode(), nnkStmtList.newTree( nnkYieldStmt.newTree( newIdentNode("x") ) ) ), nnkForStmt.newTree( newIdentNode("i"), nnkCall.newTree( newIdentNode("hello"), newLit(12) ), nnkStmtList.newTree( nnkCommand.newTree( newIdentNode("echo"), newIdentNode("i") ) ) ) ) ```
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.4
  • Created 2024-10-13T11:09:39Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

:robot: Bug found in 6 mins bisecting 8 commits at 1 commits per second

metagn commented 1 month ago

I think this is a general problem, inline iterator parameters aren't addressable:

iterator hello(x: int): int =
  let y = addr(x)
  yield 123

for i in hello(12):
  echo i
@min.nim.c: In function 'NimMainModule':
@min.nim.c:135:62: error: lvalue required as unary '&' operand
  135 |                 y = (&((NI)12));