-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
problem 1
nim c -o:bin/nimsuggest -d:danger nimsuggest/nimsuggest.nim
nim r nimsuggest/tester nimsuggest/tests/tmacro_highlight.nim
works
nim c -o:bin/nimsuggest -d:release nimsuggest/nimsuggest.nim
nim r nimsuggest/tester nimsuggest/tests/tmacro_highlight.nim
fails:
==== STDIN ======================================
Test failed: /Users/timothee/git_clone/nim/Nim_prs/nimsuggest/tests/tmacro_highlight.nim
Expected: highlight skMacro 1 6 1
highlight skType 1 11 6
highlight skType 1 20 7
highlight skMacro 3 0 1
highlight skMacro 3 0 1
But got: highlight skMacro 1 6 1
highlight skType 1 11 6
highlight skType 1 20 7
highlight skMacro 3 0 1
highlight skMacro 3 0 1
fatal.nim(53) sysFatal
Error: unhandled exception: value out of range: -1 notin 0 .. 9223372036854775807 [RangeDefect]
stacktrace
nim c -o:bin/nimsuggest --stacktrace -u:nimCompilerStacktraceHints nimsuggest/nimsuggest.nim
nim r nimsuggest/tester nimsuggest/tests/tmacro_highlight.nim
==== STDIN ======================================
Test failed: /Users/timothee/git_clone/nim/Nim_prs/nimsuggest/tests/tmacro_highlight.nim
Expected: highlight skMacro 1 6 1
highlight skType 1 11 6
highlight skType 1 20 7
highlight skMacro 3 0 1
highlight skMacro 3 0 1
But got: highlight skMacro 1 6 1
highlight skType 1 11 6
highlight skType 1 20 7
highlight skMacro 3 0 1
highlight skMacro 3 0 1
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(651) nimsuggest
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(648) handleCmdLine
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(548) mainCommand
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(497) mainThread
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(463) execCmd
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(210) execute
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(194) executeNoHooks
/Users/timothee/git_clone/nim/Nim_devel/compiler/modules.nim(177) compileProject
/Users/timothee/git_clone/nim/Nim_devel/compiler/modules.nim(97) compileModule
/Users/timothee/git_clone/nim/Nim_devel/compiler/passes.nim(180) processModule
/Users/timothee/git_clone/nim/Nim_devel/compiler/passes.nim(73) processTopLevelStmt
/Users/timothee/git_clone/nim/Nim_devel/compiler/sem.nim(641) myProcess
/Users/timothee/git_clone/nim/Nim_devel/compiler/sem.nim(604) semStmtAndGenerateGenerics
/Users/timothee/git_clone/nim/Nim_devel/compiler/semstmts.nim(2315) semStmt
/Users/timothee/git_clone/nim/Nim_devel/compiler/semexprs.nim(1057) semExprNoType
/Users/timothee/git_clone/nim/Nim_devel/compiler/semexprs.nim(2942) semExpr
/Users/timothee/git_clone/nim/Nim_devel/compiler/semstmts.nim(2257) semStmtList
/Users/timothee/git_clone/nim/Nim_devel/compiler/semexprs.nim(2824) semExpr
/Users/timothee/git_clone/nim/Nim_devel/compiler/semexprs.nim(1040) semDirectOp
/Users/timothee/git_clone/nim/Nim_devel/compiler/semexprs.nim(922) afterCallActions
/Users/timothee/git_clone/nim/Nim_devel/compiler/sem.nim(480) semMacroExpr
/Users/timothee/git_clone/nim/Nim_devel/compiler/vm.nim(2303) evalMacroCall
/Users/timothee/git_clone/nim/Nim_devel/compiler/vmgen.nim(2301) genProc
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(53) sysFatal
Error: unhandled exception: value out of range: -1 notin 0 .. 9223372036854775807 [RangeDefect]
=> c.prc.regInfo.setLen s.offset is the line that raises, s.offset is -1
problem 2
in the stacktrace above, note the 2 different compilers being used:
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(194) executeNoHooks
/Users/timothee/git_clone/nim/Nim_devel/compiler/modules.nim(177) compileProject
but this isn't related to problem 1, because with different flags / compiler, i get similar stacktrace as above but with just 1 compiler path eg:
/Users/timothee/git_clone/nim/Nim_prs/nimsuggest/nimsuggest.nim(194) executeNoHooks
/Users/timothee/git_clone/nim/Nim_prs/compiler/modules.nim(177) compileProject
Possible Solution
- build with -d:release in runCI and koch tools
- fix corresponding bugs
Additional Information
nim 1.5.1 6387e28
- this may explain the patches i had to do in nim check: make error msgs less redundant #17865 refs nim check: make error msgs less redundant #17865 (comment)
- this may also explain nimsuggest complications in improvements to hint:processing: show import stack, distinguish nims, show includes etc #18372
- ditto with nimsuggest/tests/tmacro_highlight.nim fails after unrelated changes on i386 #17945
- ditto with nimsuggest reporting value out of range: -1 notin 0 .. 9223372036854775807 [RangeDefect] #14461
note
if i add doAssert s.offset >= 0, $(s.offset, s) above c.prc.regInfo.setLen s.offset, un-surprisingly, with -d:danger it now does crash with:
Error: unhandled exception: vmgen.nim(2301, 14) s.offset >= 0 (-1, a@452984833) [AssertionDefect]
instead of succeeding, as expected (but still the same bug)