-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Double destroy using proc type alias with a sink #23907
Comments
!nim c type
Thingy = object
value: int
ExecProc[C] = proc(value: sink C): void
proc `=copy`(a: var Thingy, b: Thingy) {.error.}
var thingyDestroyCount = 0
proc `=destroy`(thingy: Thingy) =
assert(thingyDestroyCount <= 0)
thingyDestroyCount = 1
proc store(value: sink Thingy): void =
echo value
let callback: ExecProc[Thingy] = store
callback(Thingy(value: 123)) |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👎 FAILOutput
IRCompiled filesize98.87 Kb (101,240 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw tyObject_RefHeader__YmUax3FsG7Gnj3DF0PcAlw;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
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, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u54)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u235)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4613)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u103)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3461)(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);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u99;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4397;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR TFrame* framePtr__system_u2654;
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_u4397);
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_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_u4613();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2654 = (*framePtr__system_u2654).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u235(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u54(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
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_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3461(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u103)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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) {
{
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw colontmpD_;
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&colontmpD_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u99.ClE_0 = T1_.ClE_0;
callback__temp_u99.ClP_0 = T1_.ClP_0;
colontmpD_.value = ((NI)123);
callback__temp_u99.ClE_0? callback__temp_u99.ClP_0(colontmpD_, callback__temp_u99.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u99.ClP_0))(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u11(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u103((&callback__temp_u99));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) stable 👎 FAILOutput
IRCompiled filesize98.83 Kb (101,200 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__m5DjWPRDLSOOpTFPKmlVBA tyObject_RefHeader__m5DjWPRDLSOOpTFPKmlVBA;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__m5DjWPRDLSOOpTFPKmlVBA {
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, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u270)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3481)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__m5DjWPRDLSOOpTFPKmlVBA* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR TFrame* framePtr__system_u4059;
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_u4402);
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_u4059 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4059;
framePtr__system_u4059 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4620();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4059 = (*framePtr__system_u4059).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u270(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.8/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.8/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__m5DjWPRDLSOOpTFPKmlVBA* 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__m5DjWPRDLSOOpTFPKmlVBA*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3481(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot8atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw colontmpD_;
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&colontmpD_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
colontmpD_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(colontmpD_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u11(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) 2.0.4 👎 FAILOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw tyObject_RefHeader__bT6rHCap81aoFk2UwTCpIw;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
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, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(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_NOCONV(void, deallocShared)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, 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);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
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, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
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_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
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_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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) {
{
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw colontmpD_;
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&colontmpD_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
colontmpD_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(colontmpD_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u11(colontmpD_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) 2.0.0 👍 OKOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag {
NI rc;
NI rootIdx;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
};
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
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);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3403)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/arithmetics.nim");
result = (NI)0;
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.0/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* 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__6F2b1ehFhXQfpzB3oYziag*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3403(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw T2_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
nimZeroMem((void*)(&T2_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
T2_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(T2_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(T2_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
1.6.20 👎 FAILOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag {
NI rc;
NI rootIdx;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
};
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
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);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3403)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/arithmetics.nim");
result = (NI)0;
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.0/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* 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__6F2b1ehFhXQfpzB3oYziag*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3403(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw T2_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
nimZeroMem((void*)(&T2_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
T2_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(T2_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(T2_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag {
NI rc;
NI rootIdx;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
};
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
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);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3403)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/arithmetics.nim");
result = (NI)0;
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.0/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* 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__6F2b1ehFhXQfpzB3oYziag*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3403(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw T2_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
nimZeroMem((void*)(&T2_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
T2_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(T2_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(T2_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) 1.2.18 👎 FAILOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag {
NI rc;
NI rootIdx;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
};
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
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);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3403)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/arithmetics.nim");
result = (NI)0;
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.0/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* 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__6F2b1ehFhXQfpzB3oYziag*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3403(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw T2_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
nimZeroMem((void*)(&T2_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
T2_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(T2_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(T2_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) 1.0.10 👎 FAILOutput
IRCompiled filesize96.89 Kb (99,216 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_Thingy__9bogoebRvrwzpT5DgDIgSvw tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
typedef struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag;
typedef struct TNimTypeV2 TNimTypeV2;
typedef struct {
N_NIMCALL_PTR(void, ClP_0) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
void* ClE_0;
} tyProc__57He2SY0oGSpYVIsnenmhw;
struct tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw {
NI value;
};
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_5) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0, void* ClE_0);
typedef N_CLOSURE_PTR(void, TM__SRd76hP9cMfCzdUO857UhQQ_6) (tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
struct tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag {
NI rc;
NI rootIdx;
};
struct TNimTypeV2 {
void* destructor;
NI size;
NI16 align;
NI16 depth;
NU32* display;
void* traceImpl;
void* typeInfoV1;
NI flags;
};
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0);
N_LIB_PRIVATE N_NIMCALL(NimStringV2, dollar___temp_u55)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw x_p0);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0);
N_LIB_PRIVATE N_NIMCALL(void, failedAssertImpl__stdZassertions_u310)(NimStringV2 msg_p0);
N_LIB_PRIVATE N_NOINLINE(void, raiseOverflow)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
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);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* 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, rememberCycle__system_u3403)(NIM_BOOL isDestroyAction_p0, tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* s_p1, TNimTypeV2* desc_p2);
N_LIB_PRIVATE N_NIMCALL(void, nimDestroyAndDispose)(void* p_p0);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
static const struct {
NI cap; NIM_CHAR data[68 1];
} TM__SRd76hP9cMfCzdUO857UhQQ_2 = { 68 | NIM_STRLIT_FLAG, "/home/runner/work/Nim/Nim/temp.nim(8, 11) `thingyDestroyCount <= 0` " };
static const NimStringV2 TM__SRd76hP9cMfCzdUO857UhQQ_3 = {68, (NimStrPayload*)&TM__SRd76hP9cMfCzdUO857UhQQ_2};
N_LIB_PRIVATE tyProc__57He2SY0oGSpYVIsnenmhw callback__temp_u101;
N_LIB_PRIVATE NI thingyDestroyCount__temp_u10 = ((NI)0);
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u11)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw thingy_p0) {
NI TM__SRd76hP9cMfCzdUO857UhQQ_4;
NIM_BOOL* nimErr_;
nimfr_("=destroy", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
{
if (!!((thingyDestroyCount__temp_u10 <= ((NI)0)))) goto LA3_;
failedAssertImpl__stdZassertions_u310(TM__SRd76hP9cMfCzdUO857UhQQ_3);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
if (nimAddInt(thingyDestroyCount__temp_u10, ((NI)1), &TM__SRd76hP9cMfCzdUO857UhQQ_4)) { raiseOverflow(); goto BeforeRet_;
};
thingyDestroyCount__temp_u10 = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_4);
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, store__temp_u22)(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw value_p0) {
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NIM_BOOL oldNimErrFin1_;
NIM_BOOL* nimErr_;
nimfr_("store", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
colontmpD_ = dollar___temp_u55(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
oldNimErrFin1_ = *nimErr_; *nimErr_ = NIM_FALSE;
eqdestroy___temp_u11(value_p0);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
*nimErr_ = oldNimErrFin1_;
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
static N_INLINE(void, nimSetMem__systemZmemory_u7)(void* a_p0, int v_p1, NI size_p2) {
void* T1_;
T1_ = (void*)0;
T1_ = memset(a_p0, v_p1, ((size_t) (size_p2)));
}
static N_INLINE(void, nimZeroMem)(void* p_p0, NI size_p1) {
NIM_BOOL* nimErr_;
{nimErr_ = nimErrorFlag();
nimSetMem__systemZmemory_u7(p_p0, ((int)0), size_p1);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
}
static N_INLINE(NI, minuspercent___system_u810)(NI x_p0, NI y_p1) {
NI result;
nimfr_("-%", "/home/runner/.choosenim/toolchains/nim-2.0.0/lib/system/arithmetics.nim");
result = (NI)0;
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.0/lib/system/orc.nim");
{nimErr_ = nimErrorFlag();
result = (NIM_BOOL)0;
{
tyObject_RefHeader__6F2b1ehFhXQfpzB3oYziag* 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__6F2b1ehFhXQfpzB3oYziag*) (T5_));
{
if (!((NI)((*cell).rc & ((NI)-16)) == ((NI)0))) goto LA8_;
result = NIM_TRUE;
}
goto LA6_;
LA8_: ;
{
NI TM__SRd76hP9cMfCzdUO857UhQQ_7;
if (nimSubInt((*cell).rc, ((NI)16), &TM__SRd76hP9cMfCzdUO857UhQQ_7)) { raiseOverflow(); goto BeforeRet_;
};
(*cell).rc = (NI)(TM__SRd76hP9cMfCzdUO857UhQQ_7);
}
LA6_: ;
rememberCycle__system_u3403(result, cell, (*((TNimTypeV2**) (p_p0))));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}
LA3_: ;
}BeforeRet_: ;
popFrame();
return result;
}
N_LIB_PRIVATE N_NIMCALL(void, eqdestroy___temp_u105)(tyProc__57He2SY0oGSpYVIsnenmhw* dest_p0) {
{
NIM_BOOL T3_;
T3_ = (NIM_BOOL)0;
T3_ = nimDecRefIsLastCyclicDyn((*dest_p0).ClE_0);
if (!T3_) goto LA4_;
nimDestroyAndDispose((*dest_p0).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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
tyProc__57He2SY0oGSpYVIsnenmhw T1_;
tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw T2_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
nimZeroMem((void*)(&T1_), sizeof(tyProc__57He2SY0oGSpYVIsnenmhw));
T1_.ClP_0 = ((TM__SRd76hP9cMfCzdUO857UhQQ_5) (store__temp_u22)); T1_.ClE_0 = NIM_NIL;
callback__temp_u101.ClE_0 = T1_.ClE_0;
callback__temp_u101.ClP_0 = T1_.ClP_0;
nimZeroMem((void*)(&T2_), sizeof(tyObject_Thingy__9bogoebRvrwzpT5DgDIgSvw));
T2_.value = ((NI)123);
callback__temp_u101.ClE_0? callback__temp_u101.ClP_0(T2_, callback__temp_u101.ClE_0):((TM__SRd76hP9cMfCzdUO857UhQQ_6)(callback__temp_u101.ClP_0))(T2_);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
eqdestroy___temp_u105((&callback__temp_u101));
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
newIdentNode("Thingy"),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("value"),
newIdentNode("int"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
newIdentNode("ExecProc"),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("C"),
newEmptyNode(),
newEmptyNode()
)
),
nnkProcTy.newTree(
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("C")
),
newEmptyNode()
)
),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("copy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Thingy")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("b"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("error")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("thingyDestroyCount"),
newEmptyNode(),
newLit(0)
)
),
nnkProcDef.newTree(
nnkAccQuoted.newTree(
newIdentNode("="),
newIdentNode("destroy")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("thingy"),
newIdentNode("Thingy"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("assert"),
nnkInfix.newTree(
newIdentNode("<="),
newIdentNode("thingyDestroyCount"),
newLit(0)
)
),
nnkInfix.newTree(
newIdentNode(" ="),
newIdentNode("thingyDestroyCount"),
newLit(1)
)
)
),
nnkProcDef.newTree(
newIdentNode("store"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("void"),
nnkIdentDefs.newTree(
newIdentNode("value"),
nnkCommand.newTree(
newIdentNode("sink"),
newIdentNode("Thingy")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCommand.newTree(
newIdentNode("echo"),
newIdentNode("value")
)
)
),
nnkLetSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("callback"),
nnkBracketExpr.newTree(
newIdentNode("ExecProc"),
newIdentNode("Thingy")
),
newIdentNode("store")
)
),
nnkCall.newTree(
newIdentNode("callback"),
nnkObjConstr.newTree(
newIdentNode("Thingy"),
nnkExprColonExpr.newTree(
newIdentNode("value"),
newLit(123)
)
)
)
) #b68e0aab4 ➡️ 🐛Diagnosticsringabout introduced a bug at
The bug is in the files:
The bug can be in the commits: (Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
@ringabout See #23907 (comment) looks like your PR introduced the bug (?) 🤔 |
Yeah, but my PR only exposed a pre-existing problem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
I expect the following code to execute without an errors:
However, it currently tries to call the
=destroy
proc twice, despite the fact that we are using asink
. This triggers theassert
I've got in there.Note that if you change the
let callback
line to remove the type definition ofExecProc[Thingy]
, everything worksNim Version
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: