{"action":"created","issue":{"url":"https://api.github.com/repos/golang/go/issues/18392","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/18392/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/18392/comments","events_url":"https://api.github.com/repos/golang/go/issues/18392/events","html_url":"https://github.com/golang/go/issues/18392","id":196787018,"number":18392,"title":"cmd/compile: Seg fault while compiling","user":{"login":"a-robinson","id":7085343,"avatar_url":"https://avatars.githubusercontent.com/u/7085343?v=3","gravatar_id":"","url":"https://api.github.com/users/a-robinson","html_url":"https://github.com/a-robinson","followers_url":"https://api.github.com/users/a-robinson/followers","following_url":"https://api.github.com/users/a-robinson/following{/other_user}","gists_url":"https://api.github.com/users/a-robinson/gists{/gist_id}","starred_url":"https://api.github.com/users/a-robinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a-robinson/subscriptions","organizations_url":"https://api.github.com/users/a-robinson/orgs","repos_url":"https://api.github.com/users/a-robinson/repos","events_url":"https://api.github.com/users/a-robinson/events{/privacy}","received_events_url":"https://api.github.com/users/a-robinson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mdempsky","id":38349,"avatar_url":"https://avatars.githubusercontent.com/u/38349?v=3","gravatar_id":"","url":"https://api.github.com/users/mdempsky","html_url":"https://github.com/mdempsky","followers_url":"https://api.github.com/users/mdempsky/followers","following_url":"https://api.github.com/users/mdempsky/following{/other_user}","gists_url":"https://api.github.com/users/mdempsky/gists{/gist_id}","starred_url":"https://api.github.com/users/mdempsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdempsky/subscriptions","organizations_url":"https://api.github.com/users/mdempsky/orgs","repos_url":"https://api.github.com/users/mdempsky/repos","events_url":"https://api.github.com/users/mdempsky/events{/privacy}","received_events_url":"https://api.github.com/users/mdempsky/received_events","type":"User","site_admin":false},"assignees":[{"login":"mdempsky","id":38349,"avatar_url":"https://avatars.githubusercontent.com/u/38349?v=3","gravatar_id":"","url":"https://api.github.com/users/mdempsky","html_url":"https://github.com/mdempsky","followers_url":"https://api.github.com/users/mdempsky/followers","following_url":"https://api.github.com/users/mdempsky/following{/other_user}","gists_url":"https://api.github.com/users/mdempsky/gists{/gist_id}","starred_url":"https://api.github.com/users/mdempsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdempsky/subscriptions","organizations_url":"https://api.github.com/users/mdempsky/orgs","repos_url":"https://api.github.com/users/mdempsky/repos","events_url":"https://api.github.com/users/mdempsky/events{/privacy}","received_events_url":"https://api.github.com/users/mdempsky/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/golang/go/milestones/42","html_url":"https://github.com/golang/go/milestone/42","labels_url":"https://api.github.com/repos/golang/go/milestones/42/labels","id":1748849,"number":42,"title":"Go1.8Maybe","description":"","creator":{"login":"bradfitz","id":2621,"avatar_url":"https://avatars.githubusercontent.com/u/2621?v=3","gravatar_id":"","url":"https://api.github.com/users/bradfitz","html_url":"https://github.com/bradfitz","followers_url":"https://api.github.com/users/bradfitz/followers","following_url":"https://api.github.com/users/bradfitz/following{/other_user}","gists_url":"https://api.github.com/users/bradfitz/gists{/gist_id}","starred_url":"https://api.github.com/users/bradfitz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bradfitz/subscriptions","organizations_url":"https://api.github.com/users/bradfitz/orgs","repos_url":"https://api.github.com/users/bradfitz/repos","events_url":"https://api.github.com/users/bradfitz/events{/privacy}","received_events_url":"https://api.github.com/users/bradfitz/received_events","type":"User","site_admin":false},"open_issues":9,"closed_issues":213,"state":"open","created_at":"2016-05-04T23:40:26Z","updated_at":"2017-01-05T01:02:28Z","due_on":"2017-01-31T08:00:00Z","closed_at":null},"comments":12,"created_at":"2016-12-20T21:35:05Z","updated_at":"2017-01-05T13:45:30Z","closed_at":null,"body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n### What version of Go are you using (`go version`)?\r\ngo version go1.7.3 darwin/amd64\r\n\r\n### What operating system and processor architecture are you using (`go env`)?\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"darwin\"\r\nGOOS=\"darwin\"\r\nGOPATH=\"/Users/alex/go\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/Cellar/go/1.7.3/libexec\"\r\nGOTOOLDIR=\"/usr/local/Cellar/go/1.7.3/libexec/pkg/tool/darwin_amd64\"\r\nCC=\"clang\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/0y/zlxqfzj16sgfrxt7p13jqxhw0000gn/T/go-build613475394=/tmp/go-build -gno-record-gcc-switches -fno-common\"\r\nCXX=\"clang++\"\r\nCGO_ENABLED=\"1\"\r\n\r\n### What did you do?\r\nI realize there are a lot of layers to un-peel here, so feel free to close if it's too much effort to reproduce.\r\n\r\nI made some modifications to [CockroachDB](https://github.com/cockroachdb/cockroach)'s codebase and tried building it with `make build` (which just wraps `go build`). With a few particular modifications, it reliably triggers a segmentation fault in the compiler. The line of code that triggers it is [this function declaration in an interface definition](https://github.com/a-robinson/cockroach/blob/compiler-segfault/pkg/migrations/migrations.go#L87), referring to the non-existent `db.Txn`. If I switch it to refer to the valid `client.Txn` type, then there's no segfault.\r\n\r\nI have the state saved in a branch on my fork, so reproducing should look something like:\r\ngo get github.com/a-robinson/cockroach\r\ncd to directory\r\ngit fetch https://github.com/a-robinson/cockroach.git\r\ngit checkout compiler-segfault\r\nmake build\r\n\r\n\r\n### What did you expect to see?\r\nCompiler errors from my bad code.\r\n\r\n### What did you see instead?\r\n\r\n```console\r\n~/go/src/github.com/cockroachdb/cockroach/pkg 0 $ make build\r\nGOPATH set to /Users/alex/go\r\n/Users/alex/go/bin added to PATH\r\ngo build -i -o cockroach -v\r\ngithub.com/cockroachdb/cockroach/pkg/config\r\ngithub.com/cockroachdb/cockroach/pkg/gossip\r\ngithub.com/cockroachdb/cockroach/pkg/sql/sqlbase\r\ngithub.com/cockroachdb/cockroach/pkg/storage/engine\r\ngithub.com/cockroachdb/cockroach/pkg/kv\r\ngithub.com/cockroachdb/cockroach/pkg/server/serverpb\r\ngithub.com/cockroachdb/cockroach/pkg/sql/distsqlplan\r\ngithub.com/cockroachdb/cockroach/pkg/sql/distsqlrun\r\ngithub.com/cockroachdb/cockroach/pkg/storage\r\ngithub.com/cockroachdb/cockroach/pkg/sql\r\ngithub.com/cockroachdb/cockroach/pkg/ts\r\ngithub.com/cockroachdb/cockroach/pkg/migrations\r\ngithub.com/cockroachdb/cockroach/pkg/sql/pgwire\r\n# github.com/cockroachdb/cockroach/pkg/migrations\r\npanic: runtime error: invalid memory address or nil pointer dereference\r\n[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x247f07]\r\n\r\ngoroutine 1 [running]:\r\npanic(0x4b76e0, 0xc420010150)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/runtime/panic.go:500 +0x1a1\r\ncmd/compile/internal/gc.typecheck1(0xc423658870, 0x6, 0xc423671120)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:864 +0x6ff7\r\ncmd/compile/internal/gc.typecheck(0xc423658870, 0x6, 0xc423698318)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.typecheck1(0xc423658900, 0x4, 0x38)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:476 +0x7e45\r\ncmd/compile/internal/gc.typecheck(0xc423658900, 0x4, 0x8)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.structfield(0xc423658a20, 0x1)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:750 +0x2ca\r\ncmd/compile/internal/gc.tofunargs(0xc4236304a0, 0x1, 0x1, 0x2, 0xc423685590)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:845 +0xc3\r\ncmd/compile/internal/gc.functype0(0xc4236854f0, 0x0, 0xc4236304a0, 0x1, 0x1, 0xc4236304a8, 0x1, 0x1)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:1039 +0x1a5\r\ncmd/compile/internal/gc.functype(0x0, 0xc4236304a0, 0x1, 0x1, 0xc4236304a8, 0x1, 0x1, 0xc423684c80)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:1024 +0x89\r\ncmd/compile/internal/gc.typecheck1(0xc423658bd0, 0x4, 0x38)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:466 +0xc8c8\r\ncmd/compile/internal/gc.typecheck(0xc423658bd0, 0x4, 0xc4203c8ea0)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.structfield(0xc423658e10, 0xc42365eb40)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:750 +0x2ca\r\ncmd/compile/internal/gc.tofunargs(0xc42363a930, 0x2, 0x2, 0x2, 0xc423685450)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:845 +0xc3\r\ncmd/compile/internal/gc.functype0(0xc4236853b0, 0xc4236587e0, 0xc42363a930, 0x2, 0x2, 0xc4236304b0, 0x1, 0x1)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:1039 +0x1a5\r\ncmd/compile/internal/gc.functype(0xc4236587e0, 0xc42363a930, 0x2, 0x2, 0xc4236304b0, 0x1, 0x1, 0xc423685220)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/dcl.go:1024 +0x89\r\ncmd/compile/internal/gc.typecheck1(0xc423658fc0, 0x4, 0xc423658510)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:466 +0xc8c8\r\ncmd/compile/internal/gc.typecheck(0xc423658fc0, 0x4, 0xc423658510)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.domethod(0xc423659050)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:3422 +0x4a\r\ncmd/compile/internal/gc.typecheckdeftype(0xc42364a5a0)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:3541 +0x166\r\ncmd/compile/internal/gc.typecheckdef(0xc42364a5a0, 0xc4227bbb50)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:3711 +0x770\r\ncmd/compile/internal/gc.typecheck1(0xc42364a5a0, 0x4, 0x1)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:266 +0xd3e0\r\ncmd/compile/internal/gc.typecheck(0xc42364a5a0, 0x4, 0x10000000003b680)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.typecheck1(0xc42364acf0, 0x1, 0xc4227bdb88)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:2086 +0x637e\r\ncmd/compile/internal/gc.typecheck(0xc42364acf0, 0x1, 0x0)\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/typecheck.go:188 +0x654\r\ncmd/compile/internal/gc.Main()\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/gc/main.go:367 +0x15ef\r\ncmd/compile/internal/amd64.Main()\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/internal/amd64/galign.go:93 +0x2fa\r\nmain.main()\r\n\t/usr/local/Cellar/go/1.7.3/libexec/src/cmd/compile/main.go:33 +0x2a3\r\nmake[1]: *** [install] Error 2\r\nmake: *** [build] Error 2\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/golang/go/issues/comments/270647108","html_url":"https://github.com/golang/go/issues/18392#issuecomment-270647108","issue_url":"https://api.github.com/repos/golang/go/issues/18392","id":270647108,"user":{"login":"golang101","id":22589241,"avatar_url":"https://avatars.githubusercontent.com/u/22589241?v=3","gravatar_id":"","url":"https://api.github.com/users/golang101","html_url":"https://github.com/golang101","followers_url":"https://api.github.com/users/golang101/followers","following_url":"https://api.github.com/users/golang101/following{/other_user}","gists_url":"https://api.github.com/users/golang101/gists{/gist_id}","starred_url":"https://api.github.com/users/golang101/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/golang101/subscriptions","organizations_url":"https://api.github.com/users/golang101/orgs","repos_url":"https://api.github.com/users/golang101/repos","events_url":"https://api.github.com/users/golang101/events{/privacy}","received_events_url":"https://api.github.com/users/golang101/received_events","type":"User","site_admin":false},"created_at":"2017-01-05T13:45:30Z","updated_at":"2017-01-05T13:45:30Z","body":"A bit not relevant\r\n\r\n\tpackage main\r\n\r\n\ttype T struct{}\r\n\tfunc (T) Fn2(T.X) {} // A.X undefined (type A has no method X)\r\n\r\n\tfunc main() {\r\n\t}\r\n\r\nisn't the compiling error message some misleading?"}}
{"actor":{"display_login":"golang101"}}