-
-
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
Regression: compiler crash on static inference #23755
Comments
!nim c import std/bitops
type SecretWord* = distinct uint64
const WordBitWidth* = sizeof(SecretWord) * 8
func wordsRequired*(bits: int): int {.inline.} =
const divShiftor = fastLog2(WordBitWidth)
result = (bits + WordBitWidth - 1) shr divShiftor
type
BigInt*[bits: static int] = object
limbs*: array[bits.wordsRequired, SecretWord]
type Limbs*[N: static int] = array[N, SecretWord]
type
LimbsView* = ptr UncheckedArray[SecretWord]
LimbsViewConst* = distinct LimbsView
LimbsViewMut* = distinct LimbsView
LimbsViewAny* = LimbsViewConst or LimbsViewMut
template view*(a: Limbs): LimbsViewConst =
LimbsViewConst(cast[LimbsView](a.unsafeAddr))
template view*(a: var Limbs): LimbsViewMut =
LimbsViewMut(cast[LimbsView](a.addr))
template view*(a: openArray[SecretWord]): LimbsViewConst =
LimbsViewConst(cast[LimbsView](a[0].unsafeAddr))
template view*(a: var openArray[SecretWord]): LimbsViewMut =
LimbsViewMut(cast[LimbsView](a[0].addr))
func reduce*(r: LimbsViewMut,
a: LimbsViewAny, aBits: int,
M: LimbsViewConst, mBits: int) =
discard
func reduce*[aLen, mLen](r: var Limbs[mLen],
a: Limbs[aLen], aBits: static int,
M: Limbs[mLen], mBits: static int
) {.inline.} =
reduce(r.view(), a.view(), aBits, M.view(), mBits)
func reduce*[aBits, mBits](r: var BigInt[mBits], a: BigInt[aBits], M: BigInt[mBits]) =
reduce(r.limbs, a.limbs, aBits, M.limbs, mBits)
var a, M, r: BigInt[64]
r.reduce(a, M) |
🐧 Linux bisect by @juancarlospaco (collaborator)devel 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkImportStmt.newTree(
nnkInfix.newTree(
newIdentNode("/"),
newIdentNode("std"),
newIdentNode("bitops")
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("SecretWord")
),
newEmptyNode(),
nnkDistinctTy.newTree(
newIdentNode("uint64")
)
)
),
nnkConstSection.newTree(
nnkConstDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("WordBitWidth")
),
newEmptyNode(),
nnkInfix.newTree(
newIdentNode("*"),
nnkCall.newTree(
newIdentNode("sizeof"),
newIdentNode("SecretWord")
),
newLit(8)
)
)
),
nnkFuncDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("wordsRequired")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("int"),
nnkIdentDefs.newTree(
newIdentNode("bits"),
newIdentNode("int"),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("inline")
),
newEmptyNode(),
nnkStmtList.newTree(
nnkConstSection.newTree(
nnkConstDef.newTree(
newIdentNode("divShiftor"),
newEmptyNode(),
nnkCall.newTree(
newIdentNode("fastLog2"),
newIdentNode("WordBitWidth")
)
)
),
nnkAsgn.newTree(
newIdentNode("result"),
nnkInfix.newTree(
newIdentNode("shr"),
nnkPar.newTree(
nnkInfix.newTree(
newIdentNode("-"),
nnkInfix.newTree(
newIdentNode("+"),
newIdentNode("bits"),
newIdentNode("WordBitWidth")
),
newLit(1)
)
),
newIdentNode("divShiftor")
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
nnkDotExpr.newTree(
newIdentNode("bits"),
newIdentNode("wordsRequired")
),
newIdentNode("SecretWord")
),
newEmptyNode()
)
)
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("Limbs")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("SecretWord")
)
)
),
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("LimbsView")
),
newEmptyNode(),
nnkPtrTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("UncheckedArray"),
newIdentNode("SecretWord")
)
)
),
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("LimbsViewConst")
),
newEmptyNode(),
nnkDistinctTy.newTree(
newIdentNode("LimbsView")
)
),
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("LimbsViewMut")
),
newEmptyNode(),
nnkDistinctTy.newTree(
newIdentNode("LimbsView")
)
),
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("LimbsViewAny")
),
newEmptyNode(),
nnkInfix.newTree(
newIdentNode("or"),
newIdentNode("LimbsViewConst"),
newIdentNode("LimbsViewMut")
)
)
),
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("LimbsViewConst"),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("Limbs"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("LimbsViewConst"),
nnkCast.newTree(
newIdentNode("LimbsView"),
nnkDotExpr.newTree(
newIdentNode("a"),
newIdentNode("unsafeAddr")
)
)
)
)
),
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("LimbsViewMut"),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
newIdentNode("Limbs")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("LimbsViewMut"),
nnkCast.newTree(
newIdentNode("LimbsView"),
nnkDotExpr.newTree(
newIdentNode("a"),
newIdentNode("addr")
)
)
)
)
),
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("LimbsViewConst"),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("openArray"),
newIdentNode("SecretWord")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("LimbsViewConst"),
nnkCast.newTree(
newIdentNode("LimbsView"),
nnkDotExpr.newTree(
nnkBracketExpr.newTree(
newIdentNode("a"),
newLit(0)
),
newIdentNode("unsafeAddr")
)
)
)
)
),
nnkTemplateDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newIdentNode("LimbsViewMut"),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("openArray"),
newIdentNode("SecretWord")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("LimbsViewMut"),
nnkCast.newTree(
newIdentNode("LimbsView"),
nnkDotExpr.newTree(
nnkBracketExpr.newTree(
newIdentNode("a"),
newLit(0)
),
newIdentNode("addr")
)
)
)
)
),
nnkFuncDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("reduce")
),
newEmptyNode(),
newEmptyNode(),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("r"),
newIdentNode("LimbsViewMut"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("LimbsViewAny"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("aBits"),
newIdentNode("int"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("M"),
newIdentNode("LimbsViewConst"),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("mBits"),
newIdentNode("int"),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkFuncDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("reduce")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("aLen"),
newIdentNode("mLen"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("Limbs"),
newIdentNode("mLen")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("Limbs"),
newIdentNode("aLen")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("aBits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("M"),
nnkBracketExpr.newTree(
newIdentNode("Limbs"),
newIdentNode("mLen")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("mBits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkPragma.newTree(
newIdentNode("inline")
),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("reduce"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("view")
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("a"),
newIdentNode("view")
)
),
newIdentNode("aBits"),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("M"),
newIdentNode("view")
)
),
newIdentNode("mBits")
)
)
),
nnkFuncDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("reduce")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("aBits"),
newIdentNode("mBits"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newIdentNode("mBits")
)
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newIdentNode("aBits")
),
newEmptyNode()
),
nnkIdentDefs.newTree(
newIdentNode("M"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newIdentNode("mBits")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkCall.newTree(
newIdentNode("reduce"),
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
nnkDotExpr.newTree(
newIdentNode("a"),
newIdentNode("limbs")
),
newIdentNode("aBits"),
nnkDotExpr.newTree(
newIdentNode("M"),
newIdentNode("limbs")
),
newIdentNode("mBits")
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("a"),
newIdentNode("M"),
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("reduce")
),
newIdentNode("a"),
newIdentNode("M")
)
) stable 👍 OKOutput
IRCompiled filesize93.27 Kb (95,512 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u88)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u133)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u172)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4620)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u79;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u80;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u81;
extern NIM_THREADVAR TFrame* framePtr__system_u4059;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4402;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4059 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4059).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4059;
framePtr__system_u4059 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4620();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4059 = (*framePtr__system_u4059).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u172)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4402);
return result;
}
static N_INLINE(void, reduce__temp_u133)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u172(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u88)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u133((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot6atslibatssystemdotnim_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) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u88((&r__temp_u81), a__temp_u79, M__temp_u80);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
2.0.4 👍 OKOutput
IRCompiled filesize90.94 Kb (93,120 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4621)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, nimTestErrorFlag)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u85;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u86;
extern NIM_THREADVAR TFrame* framePtr__system_u4020;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4403;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4020 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4020).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4020;
framePtr__system_u4020 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4621();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4020 = (*framePtr__system_u4020).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (&nimInErrorMode__system_u4403);
return result;
}
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u195(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u156((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE void PreMainInner(void) {
}
N_LIB_PRIVATE int cmdCount;
N_LIB_PRIVATE char** cmdLine;
N_LIB_PRIVATE char** gEnv;
N_LIB_PRIVATE void PreMain(void) {
#if 0
void (*volatile inner)(void);
inner = PreMainInner;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000();
(*inner)();
#else
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus2dot0dot4atslibatssystemdotnim_Init000();
PreMainInner();
#endif
}
N_LIB_PRIVATE N_CDECL(void, NimMainInner)(void) {
NimMainModule();
}
N_CDECL(void, NimMain)(void) {
#if 0
void (*volatile inner)(void);
PreMain();
inner = NimMainInner;
(*inner)();
#else
PreMain();
NimMainInner();
#endif
}
int main(int argc, char** args, char** env) {
cmdLine = args;
cmdCount = argc;
gEnv = env;
NimMain();
return nim_program_result;
}
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u95((&r__temp_u86), a__temp_u84, M__temp_u85);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
2.0.0 👍 OKOutput
IRCompiled filesize90.94 Kb (93,120 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
#define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
#define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
#define nimln_(n) \
FR_.line = n;
#define nimlf_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2);
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4);
static N_INLINE(void, nimFrame)(TFrame* s_p0);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u4607)(void);
static N_INLINE(void, popFrame)(void);
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);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u85;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u86;
extern NIM_THREADVAR TFrame* framePtr__system_u4006;
extern NIM_THREADVAR NIM_BOOL nimInErrorMode__system_u4389;
static N_INLINE(void, nimFrame)(TFrame* s_p0) {
{
if (!(framePtr__system_u4006 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s_p0).calldepth = ((NI16)0);
}
goto LA1_;
LA3_: ;
{
(*s_p0).calldepth = (NI16)((*framePtr__system_u4006).calldepth + ((NI16)1));
}
LA1_: ;
(*s_p0).prev = framePtr__system_u4006;
framePtr__system_u4006 = s_p0;
{
if (!((*s_p0).calldepth == ((NI16)2000))) goto LA8_;
callDepthLimitReached__system_u4607();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u4006 = (*framePtr__system_u4006).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u195)(NU64* r_p0, NU64* a_p1, NI aBits_p2, NU64* M_p3, NI mBits_p4) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(NIM_BOOL*, nimErrorFlag)(void) {
NIM_BOOL* result;
result = (NIM_BOOL*)0;
result = (&nimInErrorMode__system_u4389);
return result;
}
static N_INLINE(void, reduce__temp_u156)(NU64* r_p0, tyArray__pJyLF64dqQG9cdH8O4TEEew a_p1, tyArray__pJyLF64dqQG9cdH8O4TEEew M_p3) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u195(((NU64*) (r_p0)), ((NU64*) (a_p1)), ((NI)64), ((NU64*) (M_p3)), ((NI)64));
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u95)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r_p0, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a_p1, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M_p2) {
NIM_BOOL* nimErr_;
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
{nimErr_ = nimErrorFlag();
reduce__temp_u156((*r_p0).limbs, a_p1.limbs, M_p2.limbs);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
}BeforeRet_: ;
popFrame();
}
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) {
{
NIM_BOOL* nimErr_;
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
nimErr_ = nimErrorFlag();
reduce__temp_u95((&r__temp_u86), a__temp_u84, M__temp_u85);
if (NIM_UNLIKELY(*nimErr_)) goto BeforeRet_;
BeforeRet_: ;
nimTestErrorFlag();
popFrame();
}
} Stats
1.6.20 👍 OKOutput
IRCompiled filesize95.77 Kb (98,072 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u94)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M);
static N_INLINE(void, reduce__temp_u146)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u182)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__system_u2997)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a__temp_u83;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M__temp_u84;
N_LIB_PRIVATE tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ r__temp_u85;
extern TFrame* framePtr__system_u2564;
static N_INLINE(void, nimFrame)(TFrame* s) {
{
if (!(framePtr__system_u2564 == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__system_u2564).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__system_u2564;
framePtr__system_u2564 = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__system_u2997();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__system_u2564 = (*framePtr__system_u2564).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u182)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__temp_u146)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u182(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__temp_u94)(tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ* r, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ a, tyObject_BigInt__lUGTCTfPVJpLI319b8vggHQ M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u146((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
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;
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_DatInit000();
initStackBottomWith((void *)&inner);
atmdotdotatsdotdotatsdotdotatsdotchoosenimatstoolchainsatsnimminus1dot6dot20atslibatssystemdotnim_Init000();
(*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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__temp_u94((&r__temp_u85), a__temp_u83, M__temp_u84);
popFrame();
}
} Stats
1.4.8 👍 OKOutput
IRCompiled filesize91.52 Kb (93,712 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
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 tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
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, nimFrame)(TFrame* s) {
{
if (!(framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw == ((TFrame*) NIM_NIL))) goto LA3_;
(*s).calldepth = ((NI16) 0);
}
goto LA1_;
LA3_: ;
{
(*s).calldepth = (NI16)((*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).calldepth + ((NI16) 1));
}
LA1_: ;
(*s).prev = framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw;
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = s;
{
if (!((*s).calldepth == ((NI16) 2000))) goto LA8_;
callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw();
}
LA8_: ;
}
static N_INLINE(void, popFrame)(void) {
framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw = (*framePtr__HRfVMH3jYeBJz6Q6X9b6Ptw).prev;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
} Stats
1.2.18 👍 OKOutput
IRCompiled filesize91.24 Kb (93,432 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
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 tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
N_LIB_PRIVATE tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
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, 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 N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) {
nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
} Stats
1.0.10 👍 OKOutput
IRCompiled filesize86.34 Kb (88,416 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA;
typedef NU64 tyArray__pJyLF64dqQG9cdH8O4TEEew[1];
struct tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA {
tyArray__pJyLF64dqQG9cdH8O4TEEew limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M);
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M);
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a__pmzNoNHAcaDPxnGmV0hjXA;
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M__9aYiHOGnE31oAqZnrG9aCL5g;
tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA r__3y4WFr27BcUGKoBlMBNdbw;
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, 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;
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__R7PY5TneSSsEfK7Fr9aVoMA)(NU64* r, NU64* a, NI aBits, NU64* M, NI mBits) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp)(NU64* r, tyArray__pJyLF64dqQG9cdH8O4TEEew a, tyArray__pJyLF64dqQG9cdH8O4TEEew M) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__R7PY5TneSSsEfK7Fr9aVoMA(((NU64*) (r)), ((NU64*) (a)), ((NI) 64), ((NU64*) (M)), ((NI) 64));
popFrame();
}
N_LIB_PRIVATE N_NIMCALL(void, reduce__9caK38Hkd2c3IeEAA0rtAHA)(tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA* r, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA a, tyObject_BigInt__HAN5gSWsx9bOIwUnT9a4HjAA M) { nimfr_("reduce", "/home/runner/work/Nim/Nim/temp.nim");
reduce__7LjO8d4pQkv4X5OXdc0Lrwtemp((*r).limbs, a.limbs, M.limbs);
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
reduce__9caK38Hkd2c3IeEAA0rtAHA((&r__3y4WFr27BcUGKoBlMBNdbw), a__pmzNoNHAcaDPxnGmV0hjXA, M__9aYiHOGnE31oAqZnrG9aCL5g);
popFrame();
}
} Stats
#ccc7c45d7 ➡️ 🐛Diagnosticsryan mcconnell introduced a bug at
The bug is in the files:
The bug can be in the commits:
(Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
I'm guessing this call to proc reduceToBase(f: PType): PType =
#[
Returns the lowest order (most general) type that that is compatible with the input.
E.g.
A[T] = ptr object ... A -> ptr object
A[N: static[int]] = array[N, int] ... A -> array
]# This seems like it loses information for static inference. |
Not sure what you mean by "needed". It wasn't a prank or anything. I'll look at it later tonight when I have time. The way typeRel works is lossy because it recursively calls itself, often with a subset of the node structure. Ofc there are ways of sending info downstream, but generally that is just how it works. If this is the problem then it likely needs to be handled earlier. |
Besides I have a suspicion this might be related to the inferred return type downgrading instead of this function. Can see "Need to devalue isInferred" from the PR text: #23137 |
The line I linked to was added in #23137 (here), I was asking if removing that line would result in any wrong behavior. I just tried it and removing that line makes the code in this issue compile, We could test it against CI but I was wondering if there was any side effect you would be aware of that CI wouldn't catch, or any other insight as to whether or not that line should be there. It seems like it's stripping information about unresolved static values that subsequent lines in that block previously looked for to infer static parameter values. |
I can't think of any side effects that the CI won't catch.. That is, as they were when I made the PR. Also there were edge cases that I only coaxed out of the CI in incremental versions of the PR chains. There is a minimal example of why the line is there in the "Array" section of the PR text. I would guess that the correct fix would be to detect the static before the line you highlighted and treat them differently. |
reduced: type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
type Limbs*[N: static int] = array[N, uint64]
proc view*(a: Limbs) =
discard
proc view*(a: var Limbs) =
discard
var r: BigInt[64]
r.limbs.view() I'm getting closer to figuring out what is going on here. Just so you guys know. The way things were before the PR, that branch of also, this produces a different error. type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
proc view*[N](a: array[N, uint64]) =
discard
proc view*[N](a: var array[N, uint64]) =
discard
var r: BigInt[64]
r.limbs.view() I think that the |
!nim c type
BigInt*[bits: static int] = object
limbs*: array[8, uint64]
proc view*[N](a: array[N, uint64]) =
discard
proc view*[N](a: var array[N, uint64]) =
discard
var r: BigInt[64]
r.limbs.view() |
🐧 Linux bisect by @Graveflo (contributor)devel 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) stable 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) 2.0.4 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) 2.0.0 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) 1.6.20 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) 1.4.8 👎 FAILOutput
IRCompiled filesize0 (0 bytes)
Stats
ASTnnkStmtList.newTree(
nnkTypeSection.newTree(
nnkTypeDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("BigInt")
),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("bits"),
nnkCommand.newTree(
newIdentNode("static"),
newIdentNode("int")
),
newEmptyNode()
)
),
nnkObjectTy.newTree(
newEmptyNode(),
newEmptyNode(),
nnkRecList.newTree(
nnkIdentDefs.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("limbs")
),
nnkBracketExpr.newTree(
newIdentNode("array"),
newLit(8),
newIdentNode("uint64")
),
newEmptyNode()
)
)
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkProcDef.newTree(
nnkPostfix.newTree(
newIdentNode("*"),
newIdentNode("view")
),
newEmptyNode(),
nnkGenericParams.newTree(
nnkIdentDefs.newTree(
newIdentNode("N"),
newEmptyNode(),
newEmptyNode()
)
),
nnkFormalParams.newTree(
newEmptyNode(),
nnkIdentDefs.newTree(
newIdentNode("a"),
nnkVarTy.newTree(
nnkBracketExpr.newTree(
newIdentNode("array"),
newIdentNode("N"),
newIdentNode("uint64")
)
),
newEmptyNode()
)
),
newEmptyNode(),
newEmptyNode(),
nnkStmtList.newTree(
nnkDiscardStmt.newTree(
newEmptyNode()
)
)
),
nnkVarSection.newTree(
nnkIdentDefs.newTree(
newIdentNode("r"),
nnkBracketExpr.newTree(
newIdentNode("BigInt"),
newLit(64)
),
newEmptyNode()
)
),
nnkCall.newTree(
nnkDotExpr.newTree(
nnkDotExpr.newTree(
newIdentNode("r"),
newIdentNode("limbs")
),
newIdentNode("view")
)
)
) 1.2.18 👍 OKOutput
IRCompiled filesize87.03 Kb (89,120 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ;
typedef NU64 tyArray__9cHI9ce3NOVpqam1bGmXg5vw[8];
struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ {
tyArray__9cHI9ce3NOVpqam1bGmXg5vw limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_LIB_PRIVATE N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
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 tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ r__3y4WFr27BcUGKoBlMBNdbw;
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, 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 N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a) {
nimfr_("view", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) {
nimGC_setStackBottom(locals);
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
view__DN6WYQ3dL5Q9a6KKb0uHaLw(r__3y4WFr27BcUGKoBlMBNdbw.limbs);
popFrame();
}
} Stats
1.0.10 👍 OKOutput
IRCompiled filesize86.13 Kb (88,200 bytes)
#define NIM_INTBITS 64
#include "nimbase.h"
# define nimfr_(proc, file) \
TFrame FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_);
# define nimfrs_(proc, file, slots, length) \
struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \
FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_);
# define nimln_(n, file) \
FR_.line = n; FR_.filename = file;
typedef struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ;
typedef NU64 tyArray__9cHI9ce3NOVpqam1bGmXg5vw[8];
struct tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ {
tyArray__9cHI9ce3NOVpqam1bGmXg5vw limbs;
};
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a);
static N_INLINE(void, nimFrame)(TFrame* s);
N_LIB_PRIVATE N_NOINLINE(void, callDepthLimitReached__mMRdr4sgmnykA9aWeM9aDZlw)(void);
static N_INLINE(void, popFrame)(void);
static N_INLINE(void, initStackBottomWith)(void* locals);
N_NOINLINE(void, nimGC_setStackBottom)(void* theStackBottom);
N_LIB_PRIVATE N_NIMCALL(void, systemDatInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, systemInit000)(void);
N_LIB_PRIVATE N_NIMCALL(void, NimMainModule)(void);
tyObject_BigInt__ozQDf32ivpAQw9aNbZADH9cQ r__3y4WFr27BcUGKoBlMBNdbw;
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, 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;
}
N_LIB_PRIVATE N_NIMCALL(void, view__DN6WYQ3dL5Q9a6KKb0uHaLw)(NU64* a) { nimfr_("view", "/home/runner/work/Nim/Nim/temp.nim");
popFrame();
}
static N_INLINE(void, initStackBottomWith)(void* locals) { nimGC_setStackBottom(locals);
}
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) {
{
nimfr_("temp", "/home/runner/work/Nim/Nim/temp.nim");
view__DN6WYQ3dL5Q9a6KKb0uHaLw(r__3y4WFr27BcUGKoBlMBNdbw.limbs);
popFrame();
}
} Stats
#d11933ad9 ➡️ 🐛Diagnosticsjcosborn introduced a bug at
The bug is in the files:
The bug can be in the commits:
(Diagnostics sometimes off-by-one). Stats
🤖 Bug found in |
The following snippet works on Nim v2.0.6 but crashes on Nim-devel
It crashes in release mode at
And in debug:
The text was updated successfully, but these errors were encountered: