Skip to content
New issue

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

cmd/compile: compiler crash on valid code #10654

Closed
crawshaw opened this issue May 1, 2015 · 5 comments
Closed

cmd/compile: compiler crash on valid code #10654

crawshaw opened this issue May 1, 2015 · 5 comments
Milestone

Comments

@crawshaw
Copy link
Member

crawshaw commented May 1, 2015

At rev 5f69e73 (1 May):

package main

var s string

func main() {
    if (s == "all") != (s == "all") {
    }
}

Results in:

$ go build junk.go 
# command-line-arguments
naddr [0x208773180]
.   ANDAND u(100) l(6) tc(1) bool
.   .   EQ u(2) l(6) tc(1) bool
.   .   .   LEN u(2) a(true) l(6) tc(1) int
.   .   .   .   NAME-main.s u(1) a(true) l(3) x(0+0) class(PEXTERN) tc(1) used(true) string
.   .   .   LITERAL-3 u(1) a(true) x(0+0) tc(1) int
.   .   CALLFUNC u(100) l(6) tc(1) bool
.   .   .   NAME-runtime.eqstring u(1) a(true) l(2) x(0+0) class(PFUNC) tc(1) used(true) FUNC-func(string, string) bool
.   .   CALLFUNC-list
.   .   .   AS u(1) l(6) tc(1)
.   .   .   .   INDREG-SP a(true) l(6) x(0+0) tc(1) string
.   .   .   .   NAME-main.s u(1) a(true) l(3) x(0+0) class(PEXTERN) tc(1) used(true) string

.   .   .   AS u(1) l(6) tc(1)
.   .   .   .   INDREG-SP a(true) l(6) x(16+0) tc(1) string
.   .   .   .   LITERAL-"all" u(1) a(true) l(6) tc(1) string
./junk.go:6: internal compiler error: naddr: bad && 
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x14a737]

goroutine 1 [running]:
cmd/internal/gc.hcrash()
    /Users/crawshaw/go/src/cmd/internal/gc/subr.go:105 +0x57
cmd/internal/gc.Fatal(0x38c7b0, 0x10, 0x20877b550, 0x2, 0x2)
    /Users/crawshaw/go/src/cmd/internal/gc/subr.go:213 +0x2c4
cmd/internal/gc.Naddr(0x20878b0f0, 0x208773180)
    /Users/crawshaw/go/src/cmd/internal/gc/gsubr.go:307 +0x15fc
main.gins(0x3036, 0x208773180, 0x20877c380, 0x2085b7369)
    /Users/crawshaw/go/src/cmd/6g/gsubr.go:597 +0x101
cmd/internal/gc.bgenx(0x208771180, 0x0, 0x1, 0x0, 0x20877e780)
    /Users/crawshaw/go/src/cmd/internal/gc/cgen.go:2087 +0x17f7
cmd/internal/gc.Bgen(0x208771180, 0x20877e900, 0x0, 0x20877e780)
    /Users/crawshaw/go/src/cmd/internal/gc/cgen.go:1765 +0x4e
cmd/internal/gc.gen(0x208770fc0)
    /Users/crawshaw/go/src/cmd/internal/gc/gen.go:928 +0xcec
cmd/internal/gc.Genlist(0x20873b620)
    /Users/crawshaw/go/src/cmd/internal/gc/gen.go:220 +0x37
cmd/internal/gc.compile(0x20876ba40)
    /Users/crawshaw/go/src/cmd/internal/gc/pgen.go:482 +0xba0
cmd/internal/gc.funccompile(0x20876ba40)
    /Users/crawshaw/go/src/cmd/internal/gc/dcl.go:1474 +0x1b3
cmd/internal/gc.Main()
    /Users/crawshaw/go/src/cmd/internal/gc/lex.go:464 +0x1ea7
main.main()
    /Users/crawshaw/go/src/cmd/6g/galign.go:126 +0x5f7
@ianlancetaylor ianlancetaylor added this to the Go1.5 milestone May 1, 2015
@ianlancetaylor ianlancetaylor changed the title cmd/6g: compiler crash cmd/internal/gc: compiler crash May 1, 2015
@josharian
Copy link
Contributor

This is probably my fault. @crawshaw is it blocking you? If not, I will look in a week or two.

@josharian josharian self-assigned this May 1, 2015
@crawshaw
Copy link
Member Author

crawshaw commented May 1, 2015

It's not blocking me, it just needs to be fixed before the release.

@minux
Copy link
Member

minux commented May 2, 2015 via email

@ianlancetaylor ianlancetaylor changed the title cmd/internal/gc: compiler crash cmd/compile: compiler crash Jun 2, 2015
@ianlancetaylor ianlancetaylor changed the title cmd/compile: compiler crash cmd/compile: compiler crash on valid code Jun 2, 2015
@josharian
Copy link
Contributor

Started.

@gopherbot
Copy link

CL https://golang.org/cl/10844 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants