Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C compiler error when default initializing an object field function when the default function is overloaded #23545

Open
tsoj opened this issue Apr 28, 2024 · 6 comments

Comments

@tsoj
Copy link

tsoj commented Apr 28, 2024

Description

I get a C compiler error when trying to compile this code with nim c main.nim:

proc evaluate*(params: int) =
    discard

proc evaluate*() =
    discard

type SearchInfo = object
  evaluation: proc() = evaluate

var a = SearchInfo()
error: assignment to void (*)(void *) from incompatible pointer type tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ {aka void (*)(void)}

Nim Version

Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-27
Copyright (c) 2006-2024 by Andreas Rumpf

git hash: f682dab
active boot switches: -d:release

Current Output

Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/nim.cfg' [Conf]
Hint: used config file '/home/tsoj/.choosenim/toolchains/nim-#devel/config/config.nims' [Conf]
.....................................................................
/tmp/main.nim(10, 5) Hint: 'a' is declared but not used [XDeclaredButNotUsed]
CC: main.nim
/home/tsoj/.cache/nim/main_d/@mmain.nim.c: In function ‘NimMainModule’:
/home/tsoj/.cache/nim/main_d/@mmain.nim.c:227:19: error: assignment to ‘void (*)(void *)’ from incompatible pointer type ‘tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ’ {aka ‘void (*)(void)’} [-Wincompatible-pointer-types]
  227 |         T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
      |                   ^
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3 -pthread   -I'/home/tsoj/.choosenim/toolchains/nim-#devel/lib' -I/tmp -o /home/tsoj/.cache/nim/main_d/@mmain.nim.c.o /home/tsoj/.cache/nim/main_d/@mmain.nim.c' failed with exit code: 1

Expected Output

Should compile, or alternatively give a good error message

Possible Solution

No response

Additional Information

No response

@ringabout
Copy link
Member

!nim c

proc evaluate*(params: int) =
    discard

proc evaluate*() =
    discard

type SearchInfo = object
  evaluation: proc() = evaluate

var a = SearchInfo()

@ringabout
Copy link
Member

@tsoj Hi, I cannot reprocude the example listed

Copy link
Contributor

🐧 Linux bisect by @ringabout (member)
devel 👍 OK

Output


IR

Compiled filesize 93.10 Kb (95,336 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
 void* vTable[SEQ_DECL_SIZE];
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4548)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u803)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3449)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4332;
extern NIM_THREADVAR TFrame* framePtr__system_u2647;
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_u4332);
 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_u2647 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u2647).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u2647;
 framePtr__system_u2647 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4548();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u2647 = (*framePtr__system_u2647).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u803)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-#devel/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-#devel/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u803(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3449(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
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) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:37
  • Finished 2024-04-29T07:09:38
  • Duration
stable 👍 OK

Output


IR

Compiled filesize 90.92 Kb (93,104 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.4/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.4/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
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) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:38
  • Finished 2024-04-29T07:09:38
  • Duration
2.0.2 👍 OK

Output


IR

Compiled filesize 90.93 Kb (93,112 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:41
  • Finished 2024-04-29T07:09:42
  • Duration
1.6.14 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(6, 24) Error: initialization not allowed here
fatal.nim(54)            sysFatal
Error: unhandled exception: options.nim(645, 14) `false` errGenerated [AssertionDefect]

IR

Compiled filesize 90.93 Kb (93,112 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:44
  • Finished 2024-04-29T07:09:44
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("params"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("SearchInfo"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("evaluation"),
            nnkProcTy.newTree(
              nnkFormalParams.newTree(
                newEmptyNode()
              ),
              newEmptyNode()
            ),
            newIdentNode("evaluate")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("SearchInfo")
      )
    )
  )
)
1.4.8 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(6, 24) Error: initialization not allowed here

IR

Compiled filesize 90.93 Kb (93,112 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:46
  • Finished 2024-04-29T07:09:47
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("params"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("SearchInfo"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("evaluation"),
            nnkProcTy.newTree(
              nnkFormalParams.newTree(
                newEmptyNode()
              ),
              newEmptyNode()
            ),
            newIdentNode("evaluate")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("SearchInfo")
      )
    )
  )
)
1.2.18 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(6, 24) Error: initialization not allowed here

IR

Compiled filesize 90.93 Kb (93,112 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:49
  • Finished 2024-04-29T07:09:49
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("params"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("SearchInfo"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("evaluation"),
            nnkProcTy.newTree(
              nnkFormalParams.newTree(
                newEmptyNode()
              ),
              newEmptyNode()
            ),
            newIdentNode("evaluate")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("SearchInfo")
      )
    )
  )
)
1.0.10 👎 FAIL

Output

Error: Command failed: nim c --run  -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim
/home/runner/work/Nim/Nim/temp.nim(6, 24) Error: initialization not allowed here

IR

Compiled filesize 90.93 Kb (93,112 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#include <string.h>
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
 struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
 FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
 FR_.line = n;
#define nimlf_(n, file) \
 FR_.line = n; FR_.filename = file;
typedef struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (void* ClE_0);
void* ClE_0;
} tyProc__HzVCwACFYM9cx9aV62PdjtuA;
struct tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA {
 tyProc__HzVCwACFYM9cx9aV62PdjtuA evaluation;
};
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
 NI rc;
 NI rootIdx;
};
struct TNimTypeV2 {
 void* destructor;
 NI size;
 NI16 align;
 NI16 depth;
 NU32* display;
 void* traceImpl;
 void* typeInfoV1;
 NI flags;
};
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, evaluate__temp_u3)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NOINLINE(void, rememberCycle__system_u3417)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA a__temp_u7;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
 void* T1_;
 T1_ = (void*)0;
 T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
 NIM_BOOL* result;
 result = (&nimInErrorMode__system_u4403);
 return result;
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
 nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
 if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }BeforeRet_: ;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
 {
  if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
  (*s_p0).calldepth = ((NI16)0);
 }
 goto LA1_;
LA3_: ;
 {
  (*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
 }
LA1_: ;
 (*s_p0).prev = framePtr__system_u4020;
 framePtr__system_u4020 = s_p0;
 {
  if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
  callDepthLimitReached__system_u4621();
 }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
 framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, evaluate__temp_u3)(void) {
 nimfr_("evaluate", "/home/runner/work/Nim/Nim/temp.nim");
 popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
 NI result;
 nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arithmetics.nim");
 result = ((NI) ((NU)((NU64)(((NU) (x_p0))) - (NU64)(((NU) (y_p1))))));
 popFrame();
 return result;
}
static N_INLINE(NIM_BOOL, nimDecRefIsLastCyclicDyn)(void* p_p0) {
 NIM_BOOL result;
NIM_BOOL* nimErr_;
 nimfr_("nimDecRefIsLastCyclicDyn", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
 result = (NIM_BOOL)0;
 {
  tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low* cell;
  NI T5_;
  if (!!((p_p0 == NIM_NIL))) goto LA3_;
  T5_ = (NI)0;
  T5_ = minuspercent___system_u810(((NI) (ptrdiff_t) (p_p0)), ((NI)16));
  cell = ((tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low*) (T5_));
  {
   if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
   result = NIM_TRUE;
  }
  goto LA6_;
LA8_: ;
  {
   NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
   if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
   };
   (*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
  }
LA6_: ;
  rememberCycle__system_u3417(result, cell, (*((TNimTypeV2**) (p_p0))));
  if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
 }
LA3_: ;
 }BeforeRet_: ;
 popFrame();
 return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA* dest_p0) {
 {
  NIM_BOOL T3_;
  T3_ = (NIM_BOOL)0;
  T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).evaluation.ClE_0);
  if (!T3_) goto LA4_;
  nimDestroyAndDispose((*dest_p0).evaluation.ClE_0);
 }
LA4_: ;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
 void (*volatile inner)(void);
 inner = PreMainInner;
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 (*inner)();
#else
 atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000();
 PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
 NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
 void (*volatile inner)(void);
 PreMain();
 inner = NimMainInner;
 (*inner)();
#else
 PreMain();
 NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
 cmdLine = args;
 cmdCount = argc;
 gEnv = env;
 NimMain();
 return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
 tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ colontmpD_;
 tyProc__HzVCwACFYM9cx9aV62PdjtuA T1_;
 nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
 colontmpD_ = (tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ)0;
 nimZeroMem((void*)(&a__temp_u7), sizeof(tyObject_SearchInfo__8gEYRb5dURP8lhCYW1QILA));
 colontmpD_ = evaluate__temp_u3;
 nimZeroMem((void*)(&T1_), sizeof(tyProc__HzVCwACFYM9cx9aV62PdjtuA));
 T1_.ClP_0 = colontmpD_; T1_.ClE_0 = NIM_NIL;
 a__temp_u7.evaluation.ClE_0 = T1_.ClE_0;
 a__temp_u7.evaluation.ClP_0 = T1_.ClP_0;
 eqdestroy___temp_u11((&a__temp_u7));
 nimTestErrorFlag();
 popFrame();
}
}

Stats

  • Started 2024-04-29T07:09:51
  • Finished 2024-04-29T07:09:51
  • Duration

AST

nnkStmtList.newTree(
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode(),
      nnkIdentDefs.newTree(
        newIdentNode("params"),
        newIdentNode("int"),
        newEmptyNode()
      )
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkProcDef.newTree(
    nnkPostfix.newTree(
      newIdentNode("*"),
      newIdentNode("evaluate")
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkFormalParams.newTree(
      newEmptyNode()
    ),
    newEmptyNode(),
    newEmptyNode(),
    nnkStmtList.newTree(
      nnkDiscardStmt.newTree(
        newEmptyNode()
      )
    )
  ),
  nnkTypeSection.newTree(
    nnkTypeDef.newTree(
      newIdentNode("SearchInfo"),
      newEmptyNode(),
      nnkObjectTy.newTree(
        newEmptyNode(),
        newEmptyNode(),
        nnkRecList.newTree(
          nnkIdentDefs.newTree(
            newIdentNode("evaluation"),
            nnkProcTy.newTree(
              nnkFormalParams.newTree(
                newEmptyNode()
              ),
              newEmptyNode()
            ),
            newIdentNode("evaluate")
          )
        )
      )
    )
  ),
  nnkVarSection.newTree(
    nnkIdentDefs.newTree(
      newIdentNode("a"),
      newEmptyNode(),
      nnkCall.newTree(
        newIdentNode("SearchInfo")
      )
    )
  )
)
??? ➡️ 🐛

Diagnostics

The commit that introduced the bug can not be found, but the bug is in the commits:

(Can not find the commit because Nim can not be re-built commit-by-commit to bisect).

Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.2
  • Created 2024-04-29T07:09:07Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

🤖 Bug found in 35 minutes bisecting 461 commits at 13 commits per second

@tsoj
Copy link
Author

tsoj commented Apr 29, 2024

@tsoj Hi, I cannot reprocude the example listed

I use this C compiler:

tsoj@tsoj-desktop /tmp> gcc --version
gcc (GCC) 14.0.1 20240411 (Red Hat 14.0.1-0)
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

On Fedora 40.

On Xubuntu 23.10 with this gcc version the bug doesn't appear:

C:\tmp> gcc --version
gcc (Ubuntu 13.2.0-4ubuntu3) 13.2.0
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

@tsoj
Copy link
Author

tsoj commented May 3, 2024

Also possibly related to #21801

@ringabout
Copy link
Member

See also https://forum.nim-lang.org/t/11587

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants