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.56k stars 1.47k forks source link

check command crashes on bad input #734

Closed gradha closed 10 years ago

gradha commented 10 years ago

Some input crashes the nimrod check command:

$ babel install argument_parser
$ git clone https://github.com/gradha/kpop_blog.git
$ cd kpop_blog/
$ git checkout nimrod_check_crash 
$ nimrod check kpop_blog.nim 
kpop_blog.nim(144, 17) Error: undeclared identifier: 'commands'
kpop_blog.nim(144, 16) Error: type mismatch: got (PXmlNode, string, string)
but expected one of: 
kpop_blog.test_command(command: string, url: string, short_name: string): stmt

Traceback (most recent call last)
nimrod.nim(81)           nimrod
nimrod.nim(55)           HandleCmdLine
main.nim(402)            MainCommand
main.nim(53)             CommandCheck
modules.nim(193)         CompileProject
modules.nim(151)         compileModule
passes.nim(192)          processModule
passes.nim(136)          processTopLevelStmt
sem.nim(337)             myProcess
sem.nim(306)             SemStmtAndGenerateGenerics
semstmts.nim(1265)       semStmt
semexprs.nim(825)        semExprNoType
semexprs.nim(2009)       semExpr
semstmts.nim(1101)       semProc
semstmts.nim(1048)       semProcAux
semexprs.nim(1200)       semProcBody
semexprs.nim(1991)       semExpr
semstmts.nim(1226)       semStmtList
semexprs.nim(2001)       semExpr
semstmts.nim(669)        semFor
semstmts.nim(631)        semForVars
semstmts.nim(1265)       semStmt
semexprs.nim(825)        semExprNoType
semexprs.nim(1991)       semExpr
semstmts.nim(1227)       semStmtList
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Araq commented 10 years ago

Please provide a small(er) test program for this.