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

compiler/nimeval can't be used twice: fails 2nd time with: `Error: internal error: n is not nil` #9180

Closed
timotheecour opened this issue Oct 4, 2018 · 4 comments

Comments

Projects
None yet
3 participants
@timotheecour
Copy link
Contributor

commented Oct 4, 2018

/cc @Araq
env var nimc_D points to compile git repo

import compiler / [ast, vmdef, vm, nimeval, llstream]
from os import getEnv
proc evalString(code: string, moduleName = "script.nim"):auto=
  let stream = llStreamOpen(code)
  defer: llStreamClose(stream)
  let path = getEnv("nimc_D") & "/lib/"
  var intr = createInterpreter(moduleName, [path])
  defer: destroyInterpreter(intr)
  intr.evalScript(stream)

evalString("echo 1")
evalString("echo 2")
rnim bugs/nimeval/t03_n_is_not_nil.nim
nim c --nimcache:/tmp/nim//nimcache/ -o:/tmp/nim//app -r bugs/nimeval/t03_n_is_not_nil.nim
1
???(0, 0) Error: internal error: n is not nil
Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/bugs/nimeval/t03_n_is_not_nil.nim(13) t03_n_is_not_nil
/Users/timothee/git_clone/nim/timn/bugs/nimeval/t03_n_is_not_nil.nim(8) evalString
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/nimeval.nim(115) createInterpreter
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/modules.nim(107) compileSystemModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/modules.nim(71) compileModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/passes.nim(220) processModule
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/passes.nim(95) closePasses
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/sem.nim(626) myClose
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(524) internalError
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(495) liMessage
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(324) handleError
/Users/timothee/.nimble/pkgs/compiler-0.19.0/compiler/msgs.nim(314) quit
Error: execution of an external program failed: '/tmp/nim//app '

EDIT
/cc @alaviss
looks suspiciously similar to [1] which was fixed by @alaviss

[1] running runNimScript on 2 subsequent nims files causes "Error: internal error: n is not nil" #8235

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 4, 2018

@alaviss

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2018

See #9068

@timotheecour

This comment has been minimized.

Copy link
Contributor Author

commented Oct 4, 2018

yes; I saw the thread, a better fix may indeed be to address #9068; but I'll let someone more familiar with that code do the proper fix; until then #9181 fixes this issue so I'd like it to be merged

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 4, 2018

@Araq Araq added the High Priority label Oct 9, 2018

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 9, 2018

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 9, 2018

timotheecour added a commit to timotheecour/Nim that referenced this issue Oct 9, 2018

@alaviss

This comment has been minimized.

Copy link
Contributor

commented Oct 10, 2018

@timotheecour Can you confirm that #9259 fixed this issue? If so please close it.

@timotheecour

This comment has been minimized.

Copy link
Contributor Author

commented Oct 10, 2018

it fixes it but there's still not test case for it; I've just renamed #9181 to reflect the fact that #9259 was merged in the meantime; I think it's better to close once the test case is merged, so let's wait for #9181 to close this

@Araq Araq closed this in #9181 Oct 11, 2018

Araq added a commit that referenced this issue Oct 11, 2018

test case for #9180 and re-enables the disabled tcompilerapi test (#9181
)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for #9180

* address comments

krux02 added a commit to krux02/Nim that referenced this issue Oct 15, 2018

test case for nim-lang#9180 and re-enables the disabled tcompilerapi …
…test (nim-lang#9181)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for nim-lang#9180

* address comments

narimiran added a commit to narimiran/Nim that referenced this issue Oct 31, 2018

test case for nim-lang#9180 and re-enables the disabled tcompilerapi …
…test (nim-lang#9181)

* add findNimStdLibCompileTime and un-disable tcompilerapi test; add test case for nim-lang#9180

* address comments
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.