-
-
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
Returning address of constant array emits invalid C code #22389
Comments
Using a proc foo(): ptr UncheckedArray[byte] =
const bar: cstring = ""
cast[ptr UncheckedArray[byte]](bar)
echo $repr(foo()[0]) |
related #19840 |
!nim c --gc:arc func foo(): ptr UncheckedArray[byte] =
const bar = [0.byte]
cast[ptr UncheckedArray[byte]](unsafeAddr bar[0])
echo $repr(foo()) |
@juancarlospaco (collaborator) 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;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4123)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminusathdevelatslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3578;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3933;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3578 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3578).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3578;
framePtr__system_u3578 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4123();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3578 = (*framePtr__system_u3578).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3933);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) 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) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct NimStrPayload NimStrPayload;
typedef struct NimStringV2 NimStringV2;
struct NimStrPayload {
NI cap;
NIM_CHAR data[SEQ_DECL_SIZE];
};
struct NimStringV2 {
NI len;
NimStrPayload* p;
};
typedef NimStringV2 tyArray__nHXaesL0DJZHyVS07ARPRA[1];
typedef NU8 tyUncheckedArray__nMUrxcwM7yrVbfFpM3W4Sw[1];
N_LIB_PRIVATE N_NIMCALL(NimStringV2, repr__temp_u36)(NU8* x_p0);
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4159)(void);
static N_INLINE(void, popFrame)(void);
N_LIB_PRIVATE N_NIMCALL(void, echoBinSafe)(NimStringV2* args_p0, NI args_p0Len_0);
N_LIB_PRIVATE N_NOCONV(void, deallocShared)(void* p_p0);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot0atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
extern NIM_THREADVAR TFrame* framePtr__system_u3605;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u3967;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u3605 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u3605).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u3605;
framePtr__system_u3605 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4159();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u3605 = (*framePtr__system_u3605).prev;
}
N_LIB_PRIVATE N_NIMCALL(NU8*, foo__temp_u1)(void) {
NU8* result;
nimfr_("foo", "/home/runner/work/Nim/Nim/temp.nim");
result = (NU8*)0;
result = (&((NU8)0));
popFrame();
return result;
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u3967);
return result;
}
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) {
{
NimStringV2 colontmpD_;
tyArray__nHXaesL0DJZHyVS07ARPRA T2_;
NU8* T3_;
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
colontmpD_.len = 0; colontmpD_.p = NIM_NIL;
T3_ = (NU8*)0;
T3_ = foo__temp_u1();
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
colontmpD_ = repr__temp_u36(T3_);
if (NIM_UNLIKELY(*nimErr_)) goto LA1_;
T2_[0] = colontmpD_;
echoBinSafe(T2_, 1);
{
LA1_:;
}
{
if (colontmpD_.p && !(colontmpD_.p->cap & NIM_STRLIT_FLAG)) {
deallocShared(colontmpD_.p);
}
}
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} ASTnnkStmtList.newTree(
nnkFuncDef.newTree(
newIdentNode("foo"),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("bar"),
newEmptyNode(),
nnkBracket.newTree(
nnkDotExpr.newTree(
newLit(0),
newIdentNode("byte")
)
)
)
),
nnkCast.newTree(
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("byte")
)
),
nnkCommand.newTree(
newIdentNode("unsafeAddr"),
nnkBracketExpr.newTree(
newIdentNode("bar"),
newLit(0)
)
)
)
)
),
nnkCommand.newTree(
newIdentNode("echo"),
nnkPrefix.newTree(
newIdentNode("$"),
nnkCall.newTree(
newIdentNode("repr"),
nnkCall.newTree(
newIdentNode("foo")
)
)
)
)
) Stats
🤖 Bug found in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
There is invalid codegen when returning an address to a constant array.
Nim Version
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: