Skip to content

compiler crash with order of evaluation for reordered named arguments #24963

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

Open
metagn opened this issue May 20, 2025 · 0 comments
Open

compiler crash with order of evaluation for reordered named arguments #24963

metagn opened this issue May 20, 2025 · 0 comments

Comments

@metagn
Copy link
Collaborator

metagn commented May 20, 2025

Nim Version

c3f64fb

Description

proc foo(a, b: int) =
  echo a
  echo b

proc main =
  foo(
    b = (let x = 123; 456),
    a = x)

main()

Works at top level, needs to be in a proc

Current Output

(8, 9) Error: internal error: expr: var not init x_520093701
Traceback (most recent call last)
compiler/nim.nim(169) nim
compiler/nim.nim(124) handleCmdLine
compiler/main.nim(307) mainCommand
compiler/main.nim(274) compileToBackend
compiler/main.nim(137) commandCompileToC
compiler/pipelines.nim(312) compilePipelineProject
compiler/pipelines.nim(231) compilePipelineModule
compiler/pipelines.nim(178) processPipelineModule
compiler/pipelines.nim(25) processPipeline
compiler/cgen.nim(2434) genTopLevelStmt
compiler/cgen.nim(1263) genProcBody
compiler/ccgstmts.nim(1951) genStmts
compiler/ccgexprs.nim(3580) expr
compiler/ccgexprs.nim(3236) genStmtList
compiler/ccgstmts.nim(1951) genStmts
compiler/ccgexprs.nim(3542) expr
compiler/ccgcalls.nim genCall
compiler/ccgcalls.nim(893) genAsgnCall
compiler/ccgcalls.nim(475) genPrefixCall
compiler/cgen.nim(804) initLocExpr
compiler/ccgexprs.nim(3461) expr
compiler/cgen.nim(1540) genProc
compiler/cgen.nim(1514) genProcNoForward
compiler/cgen.nim(1342) genProcAux
compiler/cgen.nim(1263) genProcBody
compiler/ccgstmts.nim(1951) genStmts
compiler/ccgexprs.nim(3580) expr
compiler/ccgexprs.nim(3236) genStmtList
compiler/ccgstmts.nim(1951) genStmts
compiler/ccgexprs.nim(3542) expr
compiler/ccgcalls.nim genCall
compiler/ccgcalls.nim(893) genAsgnCall
compiler/ccgcalls.nim(486) genPrefixCall
compiler/ccgcalls.nim(457) genParams
compiler/cgen.nim(387) genArg
compiler/cgen.nim(817) initLocExprSingleUse
compiler/ccgexprs.nim(3490) expr
compiler/msgs.nim(634) internalErrorImpl
compiler/msgs.nim(589) liMessage
compiler/msgs.nim(433) handleError
compiler/msgs.nim(421) quit

Expected Output

123
456

Known Workarounds

No response

Additional Information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant