Closed marcgehman closed 6 months ago
!nim c
const size = 100
var numbers: ref array[0..size, float]
for i in 0..<size:
numbers[i] = 3.0
93.09 Kb (95,328 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw;
struct tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw {
NI rc;
NI rootIdx;
};
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLast)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u803)(NI x_p0, NI y_p1);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4555)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u29)(NF* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimRawDispose)(void* p_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE NF* numbers__temp_u2;
N_LIB_PRIVATE NI i__temp_u7;
extern NIM_THREADVAR TFrame* framePtr__system_u2654;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u2654 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u2654).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u2654;
framePtr__system_u2654 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4555();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2654 = (*framePtr__system_u2654).prev;
}
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, nimDecRefIsLast)(void* p_p0) {
NIM_BOOL result;
nimfr_("nimDecRefIsLast", "/home/runner/.choosenim/toolchains/nim-#devel/lib/system/arc.nim");
{ 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)((NI64)((*cell).rc) >> (NU64)(((NI)4))) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
}
LA6_: ;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u29)(NF* dest_p0) {
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLast(dest_p0);
if (!T3_) goto LA4_;
eqdestroy___temp_u29(dest_p0);
nimRawDispose(dest_p0, ((NI)8));
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI)0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
if (!(i < ((NI)100))) goto LA3;
i__temp_u7 = i;
if ((NU)(i__temp_u7) > (NU)(100)){ raiseIndexError2(i__temp_u7, 100); goto BeforeRet_;
}
numbers__temp_u2[(i__temp_u7)- 0] = 3.0;
if (nimAddInt(i, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
};
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
} LA3: ;
}
}
eqdestroy___temp_u11(numbers__temp_u2);
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-05-07T18:44:48
2024-05-07T18:44:49
90.91 Kb (93,096 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw;
struct tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw {
NI rc;
NI rootIdx;
};
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLast)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
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, eqdestroy___temp_u29)(NF* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimRawDispose)(void* p_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE NF* numbers__temp_u2;
N_LIB_PRIVATE NI i__temp_u7;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
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;
}
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, nimDecRefIsLast)(void* p_p0) {
NIM_BOOL result;
nimfr_("nimDecRefIsLast", "/home/runner/.choosenim/toolchains/nim-2.0.4/lib/system/arc.nim");
{ 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)((NI64)((*cell).rc) >> (NU64)(((NI)4))) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
}
LA6_: ;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u29)(NF* dest_p0) {
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLast(dest_p0);
if (!T3_) goto LA4_;
eqdestroy___temp_u29(dest_p0);
nimRawDispose(dest_p0, ((NI)8));
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI)0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
if (!(i < ((NI)100))) goto LA3;
i__temp_u7 = i;
if ((NU)(i__temp_u7) > (NU)(100)){ raiseIndexError2(i__temp_u7, 100); goto BeforeRet_;
}
numbers__temp_u2[(i__temp_u7)- 0] = 3.0;
if (nimAddInt(i, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
};
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
} LA3: ;
}
}
eqdestroy___temp_u11(numbers__temp_u2);
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-05-07T18:44:49
2024-05-07T18:44:50
90.91 Kb (93,096 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low;
struct tyObject_RefHeader__i9cpogTuqvijClQ9bxER2Low {
NI rc;
NI rootIdx;
};
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i_p0, NI n_p1);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0);
static N_INLINE(NIM_BOOL, nimDecRefIsLast)(void* p_p0);
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1);
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, eqdestroy___temp_u29)(NF* dest_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimRawDispose)(void* p_p0, NI alignment_p1);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot2atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE NF* numbers__temp_u2;
N_LIB_PRIVATE NI i__temp_u7;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
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;
}
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, nimDecRefIsLast)(void* p_p0) {
NIM_BOOL result;
nimfr_("nimDecRefIsLast", "/home/runner/.choosenim/toolchains/nim-2.0.2/lib/system/arc.nim");
{ 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)((NI64)((*cell).rc) >> (NU64)(((NI)4))) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
}
LA6_: ;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u29)(NF* dest_p0) {
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(NF* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLast(dest_p0);
if (!T3_) goto LA4_;
eqdestroy___temp_u29(dest_p0);
nimRawDispose(dest_p0, ((NI)8));
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI)0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_2;
if (!(i < ((NI)100))) goto LA3;
i__temp_u7 = i;
if ((NU)(i__temp_u7) > (NU)(100)){ raiseIndexError2(i__temp_u7, 100); goto BeforeRet_;
}
numbers__temp_u2[(i__temp_u7)- 0] = 3.0;
if (nimAddInt(i, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_2)) { raiseOverflow(); goto BeforeRet_;
};
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_2);
} LA3: ;
}
}
eqdestroy___temp_u11(numbers__temp_u2);
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
}
```
2024-05-07T18:44:54
2024-05-07T18:44:55
95.84 Kb (98,136 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NU8 tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ;
typedef NU8 tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__3rC59cFdCULJbp2tHLSZMXQ kind;
tySet_tyEnum_TNimTypeFlag__z9aX9aBGjlpDIC58y9bKcsmzA flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w;
struct TNimNode {
tyEnum_TNimNodeKind__XtzEyxd2A8uwMJcYYak9c7w kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NF tyArray__o2BjyzIjgHx6KmyvNo9beiw[101];
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_2997)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmtempdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTIfloat__w9bl9a1ul9ctRJWiMl9cNnIMvg_;
N_LIB_PRIVATE TNimType NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_;
N_LIB_PRIVATE TNimType NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_;
N_LIB_PRIVATE NF* numbers__temp_2;
N_LIB_PRIVATE NI i__temp_7;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
extern TFrame* framePtr__system_2564;
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op) {
NF* a;
NI T1_;
a = (NF*)p;
T1_ = (NI)0;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)numbers__temp_2, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__system_2564 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__system_2564).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__system_2564;
framePtr__system_2564 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__system_2997();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_2564 = (*framePtr__system_2564).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot14atslibatssystemdotnim_Init000();
atmtempdotnim_DatInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
TFrame FR_; FR_.len = 0;
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
}
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI) 0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (!(i < ((NI) 100))) goto LA3;
i__temp_7 = i;
if ((NU)(i__temp_7) > (NU)(100)){ raiseIndexError2(i__temp_7, 100); }
numbers__temp_2[(i__temp_7)- 0] = 3.0;
if (nimAddInt(i, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); };
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
} LA3: ;
}
}
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, atmtempdotnim_DatInit000)(void) {
NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_.size = sizeof(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_.align = NIM_ALIGNOF(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_.kind = 16;
NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_.base = (&NTIfloat__w9bl9a1ul9ctRJWiMl9cNnIMvg_);
NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_.flags = 3;
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.size = sizeof(NF*);
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.align = NIM_ALIGNOF(NF*);
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.kind = 22;
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.base = (&NTIarrayL48OO494848_floatT__o2BjyzIjgHx6KmyvNo9beiw_);
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.flags = 2;
NTIrefarrayL48OO494848_floatT__Tnhx2JTyMZn9b9c5YjA6GZVg_.marker = Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg;
}
```
2024-05-07T18:44:58
2024-05-07T18:44:58
92.14 Kb (94,352 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
NI align;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NF tyArray__o2BjyzIjgHx6KmyvNo9beiw[101];
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_;
N_LIB_PRIVATE TNimType NTI__o2BjyzIjgHx6KmyvNo9beiw_;
N_LIB_PRIVATE TNimType NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_;
N_LIB_PRIVATE NF* numbers__YqJmAl4kUcO1TNXdtdli8w;
N_LIB_PRIVATE NI i__Vuap9ai8jfbvRhF5w5oYzTw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op) {
NF* a;
NI T1_;
a = (NF*)p;
T1_ = (NI)0;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)numbers__YqJmAl4kUcO1TNXdtdli8w, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
tempDatInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
TFrame FR_; FR_.len = 0;
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
}
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI) 0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (!(i < ((NI) 100))) goto LA3;
i__Vuap9ai8jfbvRhF5w5oYzTw = i;
if ((NU)(i__Vuap9ai8jfbvRhF5w5oYzTw) > (NU)(100)){ raiseIndexError2(i__Vuap9ai8jfbvRhF5w5oYzTw, 100); }
numbers__YqJmAl4kUcO1TNXdtdli8w[(i__Vuap9ai8jfbvRhF5w5oYzTw)- 0] = 3.0000000000000000e+00;
if (nimAddInt(i, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); };
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
} LA3: ;
}
}
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
NTI__o2BjyzIjgHx6KmyvNo9beiw_.size = sizeof(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.align = NIM_ALIGNOF(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.kind = 16;
NTI__o2BjyzIjgHx6KmyvNo9beiw_.base = (&NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.flags = 1;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.size = sizeof(NF*);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.align = NIM_ALIGNOF(NF*);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.kind = 22;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.base = (&NTI__o2BjyzIjgHx6KmyvNo9beiw_);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.marker = Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg;
}
```
2024-05-07T18:45:04
2024-05-07T18:45:05
91.86 Kb (94,064 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NF tyArray__o2BjyzIjgHx6KmyvNo9beiw[101];
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op);
N_LIB_PRIVATE N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_LIB_PRIVATE N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern TNimType NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_;
N_LIB_PRIVATE TNimType NTI__o2BjyzIjgHx6KmyvNo9beiw_;
N_LIB_PRIVATE TNimType NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_;
N_LIB_PRIVATE NF* numbers__YqJmAl4kUcO1TNXdtdli8w;
N_LIB_PRIVATE NI i__Vuap9ai8jfbvRhF5w5oYzTw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op) {
NF* a;
NI T1_;
a = (NF*)p;
T1_ = (NI)0;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)numbers__YqJmAl4kUcO1TNXdtdli8w, 0);
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
tempDatInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
TFrame FR_; FR_.len = 0;
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
}
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
{
NI i;
i = ((NI) 0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (!(i < ((NI) 100))) goto LA3;
i__Vuap9ai8jfbvRhF5w5oYzTw = i;
if ((NU)(i__Vuap9ai8jfbvRhF5w5oYzTw) > (NU)(100)){ raiseIndexError2(i__Vuap9ai8jfbvRhF5w5oYzTw, 100); }
numbers__YqJmAl4kUcO1TNXdtdli8w[(i__Vuap9ai8jfbvRhF5w5oYzTw)- 0] = 3.0000000000000000e+00;
if (nimAddInt(i, ((NI) 1), &TM__SRd76hP9cMfCzdUO857UhQQ_3)) { raiseOverflow(); };
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
} LA3: ;
}
}
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
NTI__o2BjyzIjgHx6KmyvNo9beiw_.size = sizeof(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.kind = 16;
NTI__o2BjyzIjgHx6KmyvNo9beiw_.base = (&NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.flags = 3;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.size = sizeof(NF*);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.kind = 22;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.base = (&NTI__o2BjyzIjgHx6KmyvNo9beiw_);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.flags = 2;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.marker = Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg;
}
```
2024-05-07T18:45:11
2024-05-07T18:45:11
86.98 Kb (89,072 bytes)
```cpp
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct TNimType TNimType;
typedef struct TNimNode TNimNode;
typedef NU8 tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A;
typedef NU8 tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ;
typedef N_NIMCALL_PTR(void, tyProc__ojoeKfW4VYIm36I9cpDTQIg) (void* p, NI op);
typedef N_NIMCALL_PTR(void*, tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ) (void* p);
struct TNimType {
NI size;
tyEnum_TNimKind__jIBKr1ejBgsfM33Kxw4j7A kind;
tySet_tyEnum_TNimTypeFlag__v8QUszD1sWlSIWZz7mC4bQ flags;
TNimType* base;
TNimNode* node;
void* finalizer;
tyProc__ojoeKfW4VYIm36I9cpDTQIg marker;
tyProc__WSm2xU5ARYv9aAR4l0z9c9auQ deepcopy;
};
typedef NU8 tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ;
struct TNimNode {
tyEnum_TNimNodeKind__unfNsxrcATrufDZmpBq4HQ kind;
NI offset;
TNimType* typ;
NCSTRING name;
NI len;
TNimNode** sons;
};
typedef NF tyArray__o2BjyzIjgHx6KmyvNo9beiw[101];
typedef N_NIMCALL_PTR(void, tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ) (void);
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op);
N_NIMCALL(void, nimGCvisit)(void* d, NI op);
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void);
N_NIMCALL(void, nimRegisterGlobalMarker)(tyProc__T4eqaYlFJYZUv9aG9b1TV0bQ markerProc);
N_NOINLINE(void, raiseIndexError2)(NI i, NI n);
static N_INLINE(NI, addInt)(NI a, NI b);
N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
NF* numbers__YqJmAl4kUcO1TNXdtdli8w;
extern TNimType NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_;
TNimType NTI__o2BjyzIjgHx6KmyvNo9beiw_;
TNimType NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_;
NI i__Vuap9ai8jfbvRhF5w5oYzTw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_NIMCALL(void, Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg)(void* p, NI op) {
NF* a;
NI T1_;
a = (NF*)p;
T1_ = (NI)0;
}
static N_NIMCALL(void, TM__SRd76hP9cMfCzdUO857UhQQ_2)(void) {
nimGCvisit((void*)numbers__YqJmAl4kUcO1TNXdtdli8w, 0);
}
static N_INLINE(NI, addInt)(NI a, NI b) { NI result;
{ result = (NI)0;
result = (NI)((NU64)(a) + (NU64)(b));
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = (((NI) 0) <= (NI)(result ^ a));
if (T3_) goto LA4_;
T3_ = (((NI) 0) <= (NI)(result ^ b));
LA4_: ;
if (!T3_) goto LA5_;
goto BeforeRet_;
}
LA5_: ;
raiseOverflow();
}BeforeRet_: ;
return result;
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) { NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
T1_ = ((NI) 0);
}
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA9_: ;
}
static N_INLINE(void, popFrame)(void) { framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
tempDatInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimRegisterGlobalMarker(TM__SRd76hP9cMfCzdUO857UhQQ_2);
{
NI i;
i = ((NI) 0);
{
while (1) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_3;
if (!(i < ((NI) 100))) goto LA3;
i__Vuap9ai8jfbvRhF5w5oYzTw = i;
if ((NU)(i__Vuap9ai8jfbvRhF5w5oYzTw) > (NU)(100)) raiseIndexError2(i__Vuap9ai8jfbvRhF5w5oYzTw, 100);
numbers__YqJmAl4kUcO1TNXdtdli8w[(i__Vuap9ai8jfbvRhF5w5oYzTw)- 0] = 3.0000000000000000e+00;
TM__SRd76hP9cMfCzdUO857UhQQ_3 = addInt(i, ((NI) 1));
i = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_3);
} LA3: ;
}
}
popFrame();
}
}
N_LIB_PRIVATE N_NIMCALL(void, tempDatInit000)(void) {
NTI__o2BjyzIjgHx6KmyvNo9beiw_.size = sizeof(tyArray__o2BjyzIjgHx6KmyvNo9beiw);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.kind = 16;
NTI__o2BjyzIjgHx6KmyvNo9beiw_.base = (&NTI__w9bl9a1ul9ctRJWiMl9cNnIMvg_);
NTI__o2BjyzIjgHx6KmyvNo9beiw_.flags = 3;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.size = sizeof(NF*);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.kind = 22;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.base = (&NTI__o2BjyzIjgHx6KmyvNo9beiw_);
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.flags = 2;
NTI__Tnhx2JTyMZn9b9c5YjA6GZVg_.marker = Marker_tyRef__Tnhx2JTyMZn9b9c5YjA6GZVg;
}
```
2024-05-07T18:45:14
2024-05-07T18:45:15
11.4.0
14.0.0
20.2
2024-05-07T18:44:14Z
1
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 30 minutes
bisecting 7
commits at 0
commits per second
removed the comment regarding basic ref arrays, as I was able to fix that by using new(),
The fix for the updated code is the same:
type
TestObj = ref object
numbers: array[0..100, float]
const size = 100
proc initTestObj(): TestObj =
new(result)
for i in 0..<size:
result.numbers[i] = 3.0
var test = initTestObj() # no error
I thought you were saying that this worked without new
in your original post, and that surprised me much more than that code not working, where it's expected behavior: refs are initialized to nil
.
Default values: https://nim-lang.org/docs/manual.html#statements-and-expressions-var-statement
Ah okay, thanks for the clarification! Given the implicit nature of the result
variable, I was expecting it to automatically handle creating with new
.
Description
I'm trying to run this simple code: This occurs if we have an array (plain or ref) within a ref object:
Again, this does not occur if we use a plain array and a plain object.
I tried with different memory managers: orc, arc, refc, and all have same issue.
Is this an expected behavior?
EDIT: removed the comment regarding basic ref arrays, as I was able to fix that by using new(), however, using arrays within a ref object still causes segfaults.
Nim Version
2.0.0 and 2.0.4
Current Output
Expected Output
No response
Possible Solution
No response
Additional Information
No response