We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go version devel +b59b42c Tue Jul 17 10:07:18 2018 +0000 linux/amd64
Compile this:
package main type A struct { X int } type B struct { *A } func main() { _ = B{X: 0} }
./bug.go:12:9: unknown field 'X' in struct literal of type B
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0xb964d8] goroutine 1 [running]: cmd/compile/internal/gc.typecheckcomplit(0xc000360380, 0x0) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:3155 +0x14f8 cmd/compile/internal/gc.typecheck1(0xc000360380, 0x2, 0xc00031b0e0) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:859 +0x4ee1 cmd/compile/internal/gc.typecheck(0xc000360380, 0x2, 0xc00031b0e0) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad cmd/compile/internal/gc.typecheckas(0xc000360300) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:3336 +0xa4 cmd/compile/internal/gc.typecheck1(0xc000360300, 0x1, 0xcb547b) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:1985 +0x3735 cmd/compile/internal/gc.typecheck(0xc000360300, 0x1, 0x3) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad cmd/compile/internal/gc.typecheckslice(0xc00000c5f0, 0x1, 0x1, 0x1) /home/rog/go/src/cmd/compile/internal/gc/typecheck.go:68 +0x50 cmd/compile/internal/gc.Main(0xcd4b28) /home/rog/go/src/cmd/compile/internal/gc/main.go:518 +0x2059 main.main() /home/rog/go/src/cmd/compile/main.go:51 +0x96
The text was updated successfully, but these errors were encountered:
Change https://golang.org/cl/124395 mentions this issue: cmd/compile: fix crash on invalid struct literal
cmd/compile: fix crash on invalid struct literal
Sorry, something went wrong.
This issue is actually a regression, on Go1.10 it returns the expected error as per https://play.golang.org/p/WqHsGsJTeAs
whereas on tip it trips out as reported
Confirmed that this was introduced by CL 97076 aka commit 42ecf39#diff-7728aae3914e92bdec496b35e670668c /cc @ChrisALiles @mdempsky
@mvdan has a CL prepared, great!
@odeke-em Thanks for identifying the regression root cause.
ba6974f
No branches or pull requests
What version of Go are you using (
go version
)?What did you do?
Compile this:
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: