-
-
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
Calling a proc with importcpp and constructor pragma generate invalid C++ code #22370
Comments
!nim cpp --gc:arc {.emit:"""
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};""".}
type
Foo {.importcpp.} = object
x: cint
Bar {.importcpp.} = object
proc constructBar(f: Foo): Bar {.importcpp: "Bar(@)", constructor.}
var b = constructBar(Foo(x: 1)) |
@juancarlospaco (contributor) devel :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3737)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__temp_u6(T1_);
extern NIM_THREADVAR TFrame* framePtr__system_u3217;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3217 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s_p0).calldepth = ((NI16)0);
} }
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3217).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3217;
framePtr__system_u3217 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
{ callDepthLimitReached__system_u3737();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3217 = (*framePtr__system_u3217).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000();
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) {
{
Foo T1_{};
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int)1);
popFrame();
}
} ASTstable :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3737)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__temp_u6(T1_);
extern NIM_THREADVAR TFrame* framePtr__system_u3217;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3217 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s_p0).calldepth = ((NI16)0);
} }
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3217).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3217;
framePtr__system_u3217 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
{ callDepthLimitReached__system_u3737();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3217 = (*framePtr__system_u3217).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
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) {
{
Foo T1_{};
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int)1);
popFrame();
}
} AST1.6.0 :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached_system_3580)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b_temp_6;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
extern TFrame* framePtr_system_3135;
static N_INLINE(void, initStackBottomWith)(void* locals) {
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr_system_3135 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr_system_3135).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr_system_3135;
framePtr_system_3135 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
{ callDepthLimitReached_system_3580();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr_system_3135 = (*framePtr_system_3135).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b_temp_6 = Bar(T1_);
popFrame();
}
} AST1.4.0 :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} AST1.2.0 :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} AST1.0.0 :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} AST0.20.2 :-1: FAILOutput
Stats
IRFilesize0 bytes
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} AST56 minutes bisecting 7 commits at 0 commits per second.
|
!nim cpp --gc:refc {.emit:"""
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};""".}
type
Foo {.importcpp.} = object
x: cint
Bar {.importcpp.} = object
proc constructBar(f: Foo): Bar {.importcpp: "Bar(@)", constructor.}
var b = constructBar(Foo(x: 1)) |
@juancarlospaco (contributor) devel 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals_p0);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3130)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__temp_u6(T1_);
extern NIM_THREADVAR TFrame* framePtr__system_u2601;
static N_INLINE(void, initStackBottomWith)(void* locals_p0) {
nimGC_setStackBottom(locals_p0);
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s_p0).calldepth = ((NI16)0);
} }
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u2601;
framePtr__system_u2601 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
{ callDepthLimitReached__system_u3130();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2601 = (*framePtr__system_u2601).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 1
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 1
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
#else
PreMain();
initStackBottomWith((void *)&inner);
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_{};
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int)1);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) stable 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals_p0);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3130)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__temp_u6(T1_);
extern NIM_THREADVAR TFrame* framePtr__system_u2601;
static N_INLINE(void, initStackBottomWith)(void* locals_p0) {
nimGC_setStackBottom(locals_p0);
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s_p0).calldepth = ((NI16)0);
} }
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u2601;
framePtr__system_u2601 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
{ callDepthLimitReached__system_u3130();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2601 = (*framePtr__system_u2601).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 1
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 1
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
#else
PreMain();
initStackBottomWith((void *)&inner);
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_{};
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int)1);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 2.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
#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;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals_p0);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom_p0);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u3130)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__temp_u6(T1_);
extern NIM_THREADVAR TFrame* framePtr__system_u2601;
static N_INLINE(void, initStackBottomWith)(void* locals_p0) {
nimGC_setStackBottom(locals_p0);
}
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u2601 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s_p0).calldepth = ((NI16)0);
} }
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u2601).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u2601;
framePtr__system_u2601 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
{ callDepthLimitReached__system_u3130();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2601 = (*framePtr__system_u2601).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 1
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystematsexceptionsdotnim_DatInit000();
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 1
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
#else
PreMain();
initStackBottomWith((void *)&inner);
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_{};
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int)1);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 1.6.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached_system_2993)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b_temp_6;
extern TFrame* framePtr_system_2564;
extern TFrame* framePtr_system_2564;
extern TFrame* framePtr_system_2564;
extern TFrame* framePtr_system_2564;
extern TFrame* framePtr_system_2564;
extern TFrame* framePtr_system_2564;
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr_system_2564 == ((TFrame*) NIM_NIL))) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr_system_2564).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr_system_2564;
framePtr_system_2564 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
{ callDepthLimitReached_system_2993();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr_system_2564 = (*framePtr_system_2564).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b_temp_6 = Bar(T1_);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 1.4.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 1.2.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA3_;
{ (*s).calldepth = ((NI16) 0);
} }
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA8_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 1.0.0 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
{ T1_ = ((NI) 0);
} }
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA9_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) 0.20.2 👎 FAILOutput
Stats
IRCompiled filesize0 bytes (0 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#undef LANGUAGE_C
#undef MIPSEB
#undef MIPSEL
#undef PPC
#undef R3000
#undef R4000
#undef i386
#undef linux
#undef mips
#undef near
#undef far
#undef powerpc
#undef unix
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
struct Foo {
int x;
};
struct Bar {
Bar(Foo f): f(f) {}
Foo f;
};
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
Bar b__iHlVDQBNmXEkRnHxFLlelA;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
extern TFrame* framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
static N_INLINE(void, nimFrame)(TFrame* s) {
NI T1_;
T1_ = (NI)0;
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == NIM_NIL)) goto LA4_;
{ T1_ = ((NI) 0);
} }
goto LA2_;
LA4_: ;
{
T1_ = ((NI) ((NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1))));
}
LA2_: ;
(*s).calldepth = ((NI16) (T1_));
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) (((NI) 2000))))) goto LA9_;
{ callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
} }
LA9_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
void PreMainInner(void) {
}
int cmdCount;
char** cmdLine;
char** gEnv;
void PreMain(void) {
void (*volatile inner)(void);
inner = PreMainInner;
systemDatInit000();
initStackBottomWith((void *)&inner);
systemInit000();
(*inner)();
}
N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
initStackBottomWith((void *)&inner);
(*inner)();
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
Foo T1_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
T1_.x = ((int) 1);
b__iHlVDQBNmXEkRnHxFLlelA = Bar(T1_);
popFrame();
}
} ASTnnkStmtList.newTree(
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("emit"),
newLit(" struct Foo {\n int x;\n };\n struct Bar {\n Bar(Foo f): f(f) {}\n Foo f;\n };")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Foo"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
newIdentNode("x"),
newIdentNode("cint"),
newEmptyNode()
)
)
)
),
nnkTypeDef.newTree(
nnkPragmaExpr.newTree(
newIdentNode("Bar"),
nnkPragma.newTree(
newIdentNode("importcpp")
)
),
newEmptyNode(),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
newEmptyNode()
)
)
),
nnkProcDef.newTree(
newIdentNode("constructBar"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("Bar"),
nnkIdentDefs.newTree(
newIdentNode("f"),
newIdentNode("Foo"),
newEmptyNode()
)
),
nnkPragma.newTree(
nnkExprColonExpr.newTree(
newIdentNode("importcpp"),
newLit("Bar(@)")
),
newIdentNode("constructor")
),
newEmptyNode(),
newEmptyNode()
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("b"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("constructBar"),
nnkObjConstr.newTree(
newIdentNode("Foo"),
nnkExprColonExpr.newTree(
newIdentNode("x"),
newLit(1)
)
)
)
)
)
) Stats
🤖 Bug found in |
either support default constructor so can separate the declaration and initialization, or treat the constructor arguments as global too. |
When wrapping an existing C++ library that cannot be edited and a class has constructors with parameters but doesn't have one without parameter, you cannot separate the declaration and initialization. |
Description
When importing C++ classes/structs and calling it's constructor to initialize module scope variable with other imported C++ classes/structs, Nim generates C++ code incorrectly.
Example code
testbugcpp.nim:
Compiled it with
nim cpp testbugcpp.nim
and got error from backend gcc.Nim Version
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2023-08-02
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: da36888
active boot switches: -d:release
Current Output
Expected Output
Possible Solution
No response
Additional Information
In Nim generated C++ code, variable
b__testbugcpp_u6
is declared outside of functions, and calls constructor with variableT1_
.But
T1_
is not declared there.N_LIB_PRIVATE Bar b__testbugcpp_u6(T1_);
It is declared in
NimMainModule
function and it is not accessible from outside of functions.Nim should generate code like:
Declaring the variable inside a procedure doesn't produce any error.
The text was updated successfully, but these errors were encountered: