nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
https://nim-lang.org
Other
16.47k stars 1.47k forks source link

Regression: compiler crash on static inference #23755

Closed mratsim closed 2 months ago

mratsim commented 3 months ago

The following snippet works on Nim v2.0.6 but crashes on Nim-devel

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]
    ## Type-erased fixed-precision limbs
    ##
    ## This type mirrors the Limb type and is used
    ## for some low-level computation API
    ## This design
    ## - avoids code bloat due to generic monomorphization
    ##   otherwise limbs routines would have an instantiation for
    ##   each number of words.
    ##
    ## Accesses should be done via BigIntViewConst / BigIntViewConst
    ## to have the compiler check for mutability

  # "Indirection" to enforce pointer types deep immutability
  LimbsViewConst* = distinct LimbsView
    ## Immutable view into the limbs of a BigInt
  LimbsViewMut* = distinct LimbsView
    ## Mutable view into a BigInt
  LimbsViewAny* = LimbsViewConst or LimbsViewMut

# Deep Mutability safety
# ------------------------------------------------------------

template view*(a: Limbs): LimbsViewConst =
  ## Returns a borrowed type-erased immutable view to a bigint
  LimbsViewConst(cast[LimbsView](a.unsafeAddr))

template view*(a: var Limbs): LimbsViewMut =
  ## Returns a borrowed type-erased mutable view to a mutable bigint
  LimbsViewMut(cast[LimbsView](a.addr))

template view*(a: openArray[SecretWord]): LimbsViewConst =
  ## Returns a borrowed type-erased immutable view to a bigint
  LimbsViewConst(cast[LimbsView](a[0].unsafeAddr))

template view*(a: var openArray[SecretWord]): LimbsViewMut =
  ## Returns a borrowed type-erased mutable view to a mutable bigint
  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)

It crashes in release mode at

assertions.nim(34)       raiseAssert
Error: unhandled exception: int128.nim(70, 11) `arg.sdata(3) == 0` out of range [AssertionDefect]

And in debug:

[...]/Nim/compiler/nim.nim(169) nim
[...]/Nim/compiler/nim.nim(124) handleCmdLine
[...]/Nim/compiler/main.nim(338) mainCommand
[...]/Nim/compiler/main.nim(304) compileToBackend
[...]/Nim/compiler/main.nim(142) commandCompileToC
[...]/Nim/compiler/pipelines.nim(325) compilePipelineProject
[...]/Nim/compiler/pipelines.nim(245) compilePipelineModule
[...]/Nim/compiler/pipelines.nim(187) processPipelineModule
[...]/Nim/compiler/sem.nim(822) semWithPContext
[...]/Nim/compiler/sem.nim(784) semStmtAndGenerateGenerics
[...]/Nim/compiler/semstmts.nim(2888) semStmt
[...]/Nim/compiler/semexprs.nim(1190) semExprNoType
[...]/Nim/compiler/semexprs.nim(3369) semExpr
[...]/Nim/lib/system.nim(918) semStmtList
[...]/Nim/compiler/semexprs.nim(3288) semExpr
[...]/Nim/compiler/semexprs.nim(1081) semIndirectOp
[...]/Nim/compiler/semexprs.nim(3268) semExpr
[...]/Nim/compiler/semexprs.nim(1171) semDirectOp
[...]/Nim/compiler/semexprs.nim(969) semOverloadedCallAnalyseEffects
[...]/Nim/compiler/semcall.nim(752) semOverloadedCall
[...]/Nim/compiler/semcall.nim(703) semResolvedCall
[...]/Nim/compiler/seminst.nim(422) generateInstance
[...]/Nim/compiler/seminst.nim(145) instantiateBody
[...]/Nim/compiler/semexprs.nim(2009) semProcBody
[...]/Nim/compiler/semexprs.nim(3369) semExpr
[...]/Nim/lib/system.nim(918) semStmtList
[...]/Nim/compiler/semexprs.nim(3286) semExpr
[...]/Nim/compiler/semexprs.nim(1171) semDirectOp
[...]/Nim/compiler/semexprs.nim(969) semOverloadedCallAnalyseEffects
[...]/Nim/compiler/semcall.nim(752) semOverloadedCall
[...]/Nim/compiler/semcall.nim(703) semResolvedCall
[...]/Nim/compiler/seminst.nim(422) generateInstance
[...]/Nim/compiler/seminst.nim(145) instantiateBody
[...]/Nim/compiler/semexprs.nim(2009) semProcBody
[...]/Nim/compiler/semexprs.nim(3369) semExpr
[...]/Nim/lib/system.nim(918) semStmtList
[...]/Nim/compiler/semexprs.nim(3286) semExpr
[...]/Nim/compiler/semexprs.nim(1171) semDirectOp
[...]/Nim/compiler/semexprs.nim(969) semOverloadedCallAnalyseEffects
[...]/Nim/compiler/semcall.nim(744) semOverloadedCall
[...]/Nim/compiler/semcall.nim(478) resolveOverloads
[...]/Nim/compiler/semcall.nim(107) pickBestCandidate
[...]/Nim/compiler/sigmatch.nim(2749) matches
[...]/Nim/compiler/sigmatch.nim(2680) matchesAux
[...]/Nim/compiler/sigmatch.nim(2471) prepareOperand
[...]/Nim/compiler/semexprs.nim(55) semOperand
[...]/Nim/compiler/semexprs.nim(3288) semExpr
[...]/Nim/compiler/semexprs.nim(1081) semIndirectOp
[...]/Nim/compiler/semexprs.nim(3286) semExpr
[...]/Nim/compiler/semexprs.nim(1171) semDirectOp
[...]/Nim/compiler/semexprs.nim(969) semOverloadedCallAnalyseEffects
[...]/Nim/compiler/semcall.nim(744) semOverloadedCall
[...]/Nim/compiler/semcall.nim(478) resolveOverloads
[...]/Nim/compiler/semcall.nim(119) pickBestCandidate
[...]/Nim/compiler/sigmatch.nim(306) cmpCandidates
[...]/Nim/compiler/sigmatch.nim(189) checkGeneric
[...]/Nim/compiler/sigmatch.nim(1253) typeRel
[...]/Nim/compiler/sigmatch.nim(1761) typeRel
[...]/Nim/compiler/sigmatch.nim(1293) typeRel
[...]/Nim/compiler/sigmatch.nim(976) inferStaticsInRange
[...]/Nim/compiler/int128.nim(70) toInt64
[...]/Nim/lib/std/assertions.nim(41) failedAssertImpl
[...]/Nim/lib/std/assertions.nim(34) raiseAssert
Error: unhandled exception: [...]/Nim/compiler/int128.nim(70, 11) `arg.sdata(3) == 0` out of range [AssertionDefect]
juancarlospaco commented 3 months ago

!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)
github-actions[bot] commented 3 months ago
:penguin: Linux bisect by @juancarlospaco (collaborator)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim assertions.nim(34) raiseAssert Error: unhandled exception: int128.nim(70, 11) `arg.sdata(3) == 0` out of range [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-24T16:56:53
  • Finished 2024-06-24T16:56:54
  • Duration

AST

```nim nnkStmtList.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 :+1: OK

Output

``` ```

IR

Compiled filesize 93.27 Kb (95,512 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_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

  • Started 2024-06-24T16:56:55
  • Finished 2024-06-24T16:56:55
  • Duration
2.0.4 :+1: OK

Output

``` ```

IR

Compiled filesize 90.94 Kb (93,120 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_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

  • Started 2024-06-24T16:56:59
  • Finished 2024-06-24T16:56:59
  • Duration
2.0.0 :+1: OK

Output

``` ```

IR

Compiled filesize 90.94 Kb (93,120 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" #define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); #define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename;NI len;VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); #define nimln_(n) \ FR_.line = n; #define nimlf_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct tyObject_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

  • Started 2024-06-24T16:57:02
  • Finished 2024-06-24T16:57:03
  • Duration
1.6.20 :+1: OK

Output

``` ```

IR

Compiled filesize 95.77 Kb (98,072 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-24T16:57:05
  • Finished 2024-06-24T16:57:06
  • Duration
1.4.8 :+1: OK

Output

``` ```

IR

Compiled filesize 91.52 Kb (93,712 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-24T16:57:08
  • Finished 2024-06-24T16:57:08
  • Duration
1.2.18 :+1: OK

Output

``` ```

IR

Compiled filesize 91.24 Kb (93,432 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-24T16:57:11
  • Finished 2024-06-24T16:57:12
  • Duration
1.0.10 :+1: OK

Output

``` ```

IR

Compiled filesize 86.34 Kb (88,416 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-24T16:57:14
  • Finished 2024-06-24T16:57:15
  • Duration
#ccc7c45d7 :arrow_right: :bug:

Diagnostics

ryan mcconnell introduced a bug at 2023-12-31 16:52:52 +0000 on commit #ccc7c45d7 with message: ``` `typRel` and `sumGeneric` adjustments (#23137) Filling in some more logic in `typeRel` that I came across when poking the compiler in another PR. Some of the cases where `typeRel` returns an "incorrect" result are actually common, but `sumGeneric` ends up breaking the tie correctly. There isn't anything wrong with that necessarily, but I assume that it's preferred these functions behave just as well in isolation as they do when integrated. I will be following up this description with specific examples. ``` The bug is in the files: ``` compiler/sigmatch.nim ``` The bug can be in the commits: (Diagnostics sometimes off-by-one).
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.3
  • Created 2024-06-24T16:50:18Z
  • Comments 1
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

:robot: Bug found in 54 minutes bisecting 671 commits at 12 commits per second

metagn commented 3 months ago

@Graveflo

I'm guessing this call to reduceToBase is the culprit, is it needed? According to the declaration of reduceToBase:

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.

Graveflo commented 3 months ago

@Graveflo

I'm guessing this call to reduceToBase is the culprit, is it needed? According to the declaration of reduceToBase:

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.

Graveflo commented 3 months ago

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: https://github.com/nim-lang/Nim/pull/23137

metagn commented 3 months ago

Not sure what you mean by "needed"

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.

Graveflo commented 3 months ago

I was asking if removing that line would result in any wrong behavior.

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.

Graveflo commented 3 months ago

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 typeRel in the tyArray section would have returned isNone. That may be valid or invalid (we'll see) but to me that proves that this doesn't have anything to do with the proc that metagn brought up erasing information down the callgraph because it would have simply returned before. I would think that array[5, 3] statically would be it's own rigid type that has an isNone relationship (in the accepting direction) with anything other than an exact match. So the isNone return value seems right to me.

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 tyArray branch just isn't designed to handle stuff like this currently. I don't think the current logic handles generics very well

Graveflo commented 3 months ago

!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()
github-actions[bot] commented 3 months ago
:penguin: Linux bisect by @Graveflo (contributor)
devel :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: fatal error: invalid kind for lastOrd(tyGenericParam) assertions.nim(34) raiseAssert Error: unhandled exception: errFatal [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:20
  • Finished 2024-06-25T05:16:20
  • Duration

AST

```nim nnkStmtList.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 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: fatal error: invalid kind for lastOrd(tyGenericParam) assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(682, 5) `false` errFatal [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:21
  • Finished 2024-06-25T05:16:22
  • Duration

AST

```nim nnkStmtList.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 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: fatal error: invalid kind for lastOrd(tyGenericParam) assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(681, 5) `false` errFatal [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:25
  • Finished 2024-06-25T05:16:25
  • Duration

AST

```nim nnkStmtList.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 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: internal error: invalid kind for lastOrd(tyGenericParam) assertions.nim(34) raiseAssert Error: unhandled exception: options.nim(664, 5) `false` errInternal [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:28
  • Finished 2024-06-25T05:16:29
  • Duration

AST

```nim nnkStmtList.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 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: fatal error: invalid kind for lastOrd(tyGenericParam) fatal.nim(54) sysFatal Error: unhandled exception: options.nim(662, 14) `false` errFatal [AssertionDefect] ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:31
  • Finished 2024-06-25T05:16:32
  • Duration

AST

```nim nnkStmtList.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 :-1: FAIL

Output

``` Error: Command failed: nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim Error: internal error: invalid kind for lastOrd(tyGenericParam) No stack traceback available To create a stacktrace, rerun compilation with './koch temp c ', see https://nim-lang.github.io/Nim/intern.html#debugging-the-compiler for details ```

IR

Compiled filesize 0 (0 bytes) ```cpp ```

Stats

  • Started 2024-06-25T05:16:34
  • Finished 2024-06-25T05:16:34
  • Duration

AST

```nim nnkStmtList.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 :+1: OK

Output

``` ```

IR

Compiled filesize 87.03 Kb (89,120 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-25T05:16:37
  • Finished 2024-06-25T05:16:38
  • Duration
1.0.10 :+1: OK

Output

``` ```

IR

Compiled filesize 86.13 Kb (88,200 bytes) ```cpp #define NIM_INTBITS 64 #include "nimbase.h" # define nimfr_(proc, file) \ TFrame FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = 0; nimFrame(&FR_); # define nimfrs_(proc, file, slots, length) \ struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; VarSlot s[slots];} FR_; \ FR_.procname = proc; FR_.filename = file; FR_.line = 0; FR_.len = length; nimFrame((TFrame*)&FR_); # define nimln_(n, file) \ FR_.line = n; FR_.filename = file; typedef struct 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

  • Started 2024-06-25T05:16:40
  • Finished 2024-06-25T05:16:40
  • Duration
#d11933ad9 :arrow_right: :bug:

Diagnostics

jcosborn introduced a bug at 2020-08-27 05:56:38 -0500 on commit #d11933ad9 with message: ``` fix some issues overloading with generics and inheritance (#15211) * fix some issues overloading with generics and inheritance * fix passing procs with subtype matches ``` The bug is in the files: ``` compiler/sigmatch.nim tests/overload/toverload_various.nim ``` The bug can be in the commits: (Diagnostics sometimes off-by-one).
Stats
  • GCC 11.4.0
  • Clang 14.0.0
  • NodeJS 20.3
  • Created 2024-06-25T05:09:41Z
  • Comments 9
  • Commands nim c --run -d:nimDebug -d:nimDebugDlOpen -d:ssl -d:nimDisableCertificateValidation --forceBuild:on --colors:off --verbosity:0 --hints:off --lineTrace:off --nimcache:/home/runner/work/Nim/Nim --out:/home/runner/work/Nim/Nim/temp /home/runner/work/Nim/Nim/temp.nim

:robot: Bug found in 37 minutes bisecting 5094 commits at 137 commits per second