Skip to content
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

compilation error with Nim HEAD #322

Closed
stefantalpalaru opened this issue Apr 23, 2019 · 5 comments

Comments

Projects
None yet
2 participants
@stefantalpalaru
Copy link
Contributor

commented Apr 23, 2019

stefan$ make nimbus
Building: build/nimbus
[NimScript] exec: nim c --out:./build/nimbus -d:chronicles_log_level=TRACE --verbosity:0 --hints:off --warnings:off nimbus/nimbus.nim
vm/interpreter_dispatch.nim(267, 22) template/generic instantiation of `genFrontierDispatch` from here
vm/interpreter/gas_costs.nim(357, 7) Error: cannot generate VM code for BaseGasCosts {.inject.}: GasCosts = block:

@mratsim mratsim self-assigned this Apr 24, 2019

@mratsim

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

Traceback:

../nimbus/vm/interpreter/gas_costs.nim(357, 7) Error: cannot generate VM code for BaseGasCosts {.inject.}: GasCosts = block:
  func fixed(gasFeeKind1189576: static[GasFeeKind]): GasCost =
    GasCost(kind: GckFixed, cost: static(FeeSchedule1189525[gasFeeKind1189576]))

  func dynamic(handler1189577: proc (value1189578: UInt256): GasInt {.nimcall.}): GasCost =
    result = GasCost(kind: GckDynamic, d_handler: handler1189577)
  
  func memExpansion(handler1189579: proc (currentMemSize1189580, memOffset1189581,
                                       memLength1189582: Natural): GasInt {.nimcall.}): GasCost =
    result = GasCost(kind: GckMemExpansion, m_handler: handler1189579)
  
  func complex(handler1189583: proc (value1189584: UInt256; gasParams1189585: GasParams): GasResult {.
      nimcall.}): GasCost =
    result = GasCost(kind: GckComplex, c_handler: handler1189583)
  
  [fixed GasZero, fixed GasVeryLow, fixed GasLow, fixed GasVeryLow, fixed GasLow,
   fixed GasLow, fixed GasLow, fixed GasLow, fixed GasMid, fixed GasMid,
   dynamic basegasExp, fixed GasLow, GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), memExpansion basegasSha3,
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), fixed GasBase, fixed GasBalance, fixed GasBase,
   fixed GasBase, fixed GasBase, fixed GasVeryLow, fixed GasBase,
   memExpansion basegasCopy, fixed GasBase, memExpansion basegasCopy, fixed GasBase,
   fixed GasExtCode, memExpansion basegasExtCodeCopy, fixed GasBase,
   memExpansion basegasCopy, GasCost(kind: GckInvalidOp), fixed GasBlockhash,
   fixed GasBase, fixed GasBase, fixed GasBase, fixed GasBase, fixed GasBase,
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp), fixed GasBase,
   memExpansion basegasLoadStore, memExpansion basegasLoadStore,
   memExpansion basegasLoadStore, fixed GasSload, complex basegasSstore, fixed GasMid,
   fixed GasHigh, fixed GasBase, fixed GasBase, fixed GasBase, fixed GasJumpDest,
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp), fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow,
   fixed GasVeryLow, fixed GasVeryLow, fixed GasVeryLow, memExpansion basegasLog0,
   memExpansion basegasLog1, memExpansion basegasLog2, memExpansion basegasLog3,
   memExpansion basegasLog4, GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp), complex basegasCreate,
   complex basegasCall, complex basegasCall, memExpansion basegasHalt,
   complex basegasCall, GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), complex basegasCall, GasCost(kind: GckInvalidOp),
   GasCost(kind: GckInvalidOp), memExpansion basegasHalt, fixed GasZero,
   complex basegasSelfDestruct]
Traceback (most recent call last)
nim.nim(98)              nim
nim.nim(75)              handleCmdLine
cmdlinehelper.nim(92)    loadConfigsAndRunMainCommand
main.nim(194)            mainCommand
main.nim(90)             commandCompileToC
modules.nim(137)         compileProject
modules.nim(78)          compileModule
passes.nim(202)          processModule
passes.nim(86)           processTopLevelStmt
sem.nim(603)             myProcess
sem.nim(571)             semStmtAndGenerateGenerics
semstmts.nim(2164)       semStmt
semexprs.nim(932)        semExprNoType
semexprs.nim(2645)       semExpr
importer.nim(212)        evalImport
importer.nim(182)        impMod
importer.nim(154)        myImportModule
modules.nim(92)          importModule
modules.nim(78)          compileModule
passes.nim(202)          processModule
passes.nim(86)           processTopLevelStmt
sem.nim(603)             myProcess
sem.nim(571)             semStmtAndGenerateGenerics
semstmts.nim(2164)       semStmt
semexprs.nim(932)        semExprNoType
semexprs.nim(2645)       semExpr
importer.nim(212)        evalImport
importer.nim(182)        impMod
importer.nim(154)        myImportModule
modules.nim(92)          importModule
modules.nim(78)          compileModule
passes.nim(202)          processModule
passes.nim(86)           processTopLevelStmt
sem.nim(603)             myProcess
sem.nim(571)             semStmtAndGenerateGenerics
semstmts.nim(2164)       semStmt
semexprs.nim(932)        semExprNoType
semexprs.nim(2645)       semExpr
importer.nim(212)        evalImport
importer.nim(182)        impMod
importer.nim(154)        myImportModule
modules.nim(92)          importModule
modules.nim(78)          compileModule
passes.nim(196)          processModule
passes.nim(86)           processTopLevelStmt
sem.nim(603)             myProcess
sem.nim(571)             semStmtAndGenerateGenerics
semstmts.nim(2164)       semStmt
semexprs.nim(932)        semExprNoType
semexprs.nim(2612)       semExpr
semstmts.nim(2104)       semStmtList
semexprs.nim(2654)       semExpr
semstmts.nim(2028)       evalInclude
semstmts.nim(2008)       incMod
semstmts.nim(2164)       semStmt
semexprs.nim(932)        semExprNoType
semexprs.nim(2612)       semExpr
semstmts.nim(2104)       semStmtList
semexprs.nim(2630)       semExpr
semstmts.nim(1940)       semProc
semstmts.nim(1868)       semProcAux
semexprs.nim(1648)       semProcBody
semexprs.nim(2612)       semExpr
semstmts.nim(2104)       semStmtList
semexprs.nim(2496)       semExpr
semexprs.nim(914)        semDirectOp
semexprs.nim(807)        afterCallActions
sem.nim(468)             semMacroExpr
vm.nim(2103)             evalMacroCall
vm.nim(1102)             rawExecute
vm.nim(449)              compile
vmgen.nim(2231)          genProc
vmgen.nim(281)           gen
vmgen.nim(2038)          gen
vmgen.nim(281)           gen
vmgen.nim(2025)          gen
vmgen.nim(336)           genBlock
vmgen.nim(2038)          gen
vmgen.nim(281)           gen
vmgen.nim(2038)          gen
vmgen.nim(281)           gen
vmgen.nim(2017)          gen
vmgen.nim(381)           genIf
vmgen.nim(2025)          gen
vmgen.nim(336)           genBlock
vmgen.nim(2024)          gen
vmgen.nim(316)           genWhile
vmgen.nim(281)           gen
vmgen.nim(2038)          gen
vmgen.nim(281)           gen
vmgen.nim(2038)          gen
vmgen.nim(281)           gen
vmgen.nim(2047)          gen
vmgen.nim(281)           gen
vmgen.nim(2041)          gen
vmgen.nim(281)           gen
vmgen.nim(2056)          gen
vmgen.nim(1828)          genVarSection
vmgen.nim(276)           gen
vmgen.nim(2025)          gen
vmgen.nim(336)           genBlock
vmgen.nim(2017)          gen
vmgen.nim(387)           genIf
vmgen.nim(2017)          gen
vmgen.nim(378)           genIf
vmgen.nim(276)           gen
vmgen.nim(1983)          gen
vmgen.nim(1024)          genMagic
vmgen.nim(674)           genBinaryABC
vmgen.nim(286)           genx
vmgen.nim(2012)          gen
vmgen.nim(1644)          genObjAccess
vmgen.nim(286)           genx
vmgen.nim(2014)          gen
vmgen.nim(1717)          genArrAccess
vmgen.nim(1628)          genArrAccess2
vmgen.nim(286)           genx
vmgen.nim(1951)          gen
vmgen.nim(1596)          genRdVar
vmgen.nim(1580)          genGlobalInit
vmgen.nim(286)           genx
vmgen.nim(2095)          gen
msgs.nim(527)            globalError
msgs.nim(515)            liMessage
msgs.nim(346)            handleError
msgs.nim(331)            quit
FAILURE
@mratsim

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

Adding some compiler debugging it seems like in devel we receive an unexpected node kind nkIdentDefs at the code generation stage: https://github.com/nim-lang/Nim/blame/devel/compiler/vmgen.nim#L2103-L2104

@mratsim

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

Upstreamed nim-lang/Nim#11111, regression introduced by nim-lang/Nim@044cef1 / nim-lang/Nim#9582

@mratsim

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

The --oldast switch will probably help until I recheck and update the fill_enum_with_holes macro for the AST changes introduced in that PR. I can't confirm yet due to spurious gcsafe issues.

@stefantalpalaru

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

I added the necessary gcsafe pragmas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.