{"action":"created","issue":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/8129","repository_url":"https://api.github.com/repos/nim-lang/Nim","labels_url":"https://api.github.com/repos/nim-lang/Nim/issues/8129/labels{/name}","comments_url":"https://api.github.com/repos/nim-lang/Nim/issues/8129/comments","events_url":"https://api.github.com/repos/nim-lang/Nim/issues/8129/events","html_url":"https://github.com/nim-lang/Nim/issues/8129","id":336177962,"node_id":"MDU6SXNzdWUzMzYxNzc5NjI=","number":8129,"title":"Regression: SIGSEGV caused by using `is` with string","user":{"login":"Vindaar","id":7742232,"node_id":"MDQ6VXNlcjc3NDIyMzI=","avatar_url":"https://avatars3.githubusercontent.com/u/7742232?v=4","gravatar_id":"","url":"https://api.github.com/users/Vindaar","html_url":"https://github.com/Vindaar","followers_url":"https://api.github.com/users/Vindaar/followers","following_url":"https://api.github.com/users/Vindaar/following{/other_user}","gists_url":"https://api.github.com/users/Vindaar/gists{/gist_id}","starred_url":"https://api.github.com/users/Vindaar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vindaar/subscriptions","organizations_url":"https://api.github.com/users/Vindaar/orgs","repos_url":"https://api.github.com/users/Vindaar/repos","events_url":"https://api.github.com/users/Vindaar/events{/privacy}","received_events_url":"https://api.github.com/users/Vindaar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-27T10:52:23Z","updated_at":"2018-06-27T11:30:42Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"I had code similar to\r\n```nim\r\nlet d = \"aaa\"\r\nif d is \"\":\r\n  echo \"help\"\r\n```\r\nin a library from when I was learning Nim. Trying to compile on the most recent devel causes a SIGSEGV during compilation.\r\n`koch` outputs:\r\n```\r\nTraceback (most recent call last)\r\nnim.nim(133)             nim\r\nnim.nim(97)              handleCmdLine\r\nmain.nim(162)            mainCommand\r\nmain.nim(73)             commandCompileToC\r\nmodules.nim(124)         compileProject\r\nmodules.nim(71)          compileModule\r\npasses.nim(194)          processModule\r\npasses.nim(103)          processTopLevelStmt\r\nsem.nim(587)             myProcess\r\nsem.nim(555)             semStmtAndGenerateGenerics\r\nsemstmts.nim(1894)       semStmt\r\nsemexprs.nim(908)        semExprNoType\r\nsemexprs.nim(2510)       semExpr\r\nsemstmts.nim(160)        semIf\r\nsemexprs.nim(59)         semExprWithType\r\nsemexprs.nim(2440)       semExpr\r\nsemexprs.nim(1988)       semMagic\r\nsemexprs.nim(410)        semIs\r\nsemexprs.nim(345)        isOpImpl\r\nSIGSEGV: Illegal storage access. (Attempt to read from nil?)\r\nFAILURE\r\n```\r\n\r\nWhile `is` and `isnot` should be used on types as I know nowadays, this should still not crash the compiler. The regression is also introduced by the recent typedesc merge of: https://github.com/nim-lang/Nim/pull/7681"},"comment":{"url":"https://api.github.com/repos/nim-lang/Nim/issues/comments/400640012","html_url":"https://github.com/nim-lang/Nim/issues/8129#issuecomment-400640012","issue_url":"https://api.github.com/repos/nim-lang/Nim/issues/8129","id":400640012,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDY0MDAxMg==","user":{"login":"LemonBoy","id":77388,"node_id":"MDQ6VXNlcjc3Mzg4","avatar_url":"https://avatars3.githubusercontent.com/u/77388?v=4","gravatar_id":"","url":"https://api.github.com/users/LemonBoy","html_url":"https://github.com/LemonBoy","followers_url":"https://api.github.com/users/LemonBoy/followers","following_url":"https://api.github.com/users/LemonBoy/following{/other_user}","gists_url":"https://api.github.com/users/LemonBoy/gists{/gist_id}","starred_url":"https://api.github.com/users/LemonBoy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LemonBoy/subscriptions","organizations_url":"https://api.github.com/users/LemonBoy/orgs","repos_url":"https://api.github.com/users/LemonBoy/repos","events_url":"https://api.github.com/users/LemonBoy/events{/privacy}","received_events_url":"https://api.github.com/users/LemonBoy/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T11:30:42Z","updated_at":"2018-06-27T11:30:42Z","author_association":"CONTRIBUTOR","body":"That check is guarded by\r\n```nim\r\n  internalAssert c.config,\r\n    n.sonsLen == 3 and\r\n    n[1].typ != nil and\r\n    n[2].kind in {nkStrLit..nkTripleStrLit, nkType}\r\n```\r\n\r\nThis means that `t2` cannot be a `tyTypeDesc`. The solutions are:\r\n\r\n-  Remove the second check in the `and`\r\n- Run `semExpr` on the n.sons[2]` node anyway before calling `isOpImpl`\r\n\r\nCC @zah since he touched this proc last"}}
{"actor":{"display_login":"LemonBoy"}}