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: internal compiler error: panic during lower (unreachable) on arm64 #30679

Closed
ALTree opened this issue Mar 8, 2019 · 4 comments

Comments

Projects
None yet
4 participants
@ALTree
Copy link
Member

commented Mar 8, 2019

$ gotip version
go version devel +9153a3ef05 Fri Mar 8 07:58:16 2019 +0000 windows/amd64

The following program:

package p

func f() {
	var f float64
	var p, q *float64

	p = &f
	if *q > 0 {
		p = q
	}
	_ = *p
}

Crashes the tip compiler, when built for linux/arm64, as follows:

$ GOOS=linux GOARCH=arm64 gotip build crash.go

# command-line-arguments
.\crash.go:8:10: internal compiler error: 'f': panic during lower while compiling f:

unreachable

goroutine 20 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc0003fb108, 0xc0003ea000)
        go/src/cmd/compile/internal/ssa/compile.go:45 +0xac
panic(0xdef300, 0x102bad0)
        go/src/runtime/panic.go:532 +0x1c3
cmd/compile/internal/ssa.arm64Negate(...)
        go/src/cmd/compile/internal/ssa/rewrite.go:734
cmd/compile/internal/ssa.rewriteValueARM64_OpARM64CSEL_0(0xc00034c620, 0x0)
        go/src/cmd/compile/internal/ssa/rewriteARM64.go:4530 +0xa7b
cmd/compile/internal/ssa.rewriteValueARM64(0xc00034c620, 0x0)
        go/src/cmd/compile/internal/ssa/rewriteARM64.go:77 +0x1d1e
cmd/compile/internal/ssa.applyRewrite(0xc0003ea000, 0xea8f90, 0xea8ff8)
        go/src/cmd/compile/internal/ssa/rewrite.go:80 +0x366
cmd/compile/internal/ssa.lower(0xc0003ea000)
        go/src/cmd/compile/internal/ssa/lower.go:10 +0x4d
cmd/compile/internal/ssa.Compile(0xc0003ea000)
        go/src/cmd/compile/internal/ssa/compile.go:90 +0x480
cmd/compile/internal/gc.buildssa(0xc0000c42c0, 0x0, 0x0)
        go/src/cmd/compile/internal/gc/ssa.go:234 +0xc04
cmd/compile/internal/gc.compileSSA(0xc0000c42c0, 0x0)
        go/src/cmd/compile/internal/gc/pgen.go:297 +0x54
cmd/compile/internal/gc.compileFunctions.func2(0xc000345e00, 0xc000054a10, 0x0)
        go/src/cmd/compile/internal/gc/pgen.go:362 +0x50
created by cmd/compile/internal/gc.compileFunctions
        go/src/cmd/compile/internal/gc/pgen.go:360 +0x130

goroutine 20 [running]:
runtime/debug.Stack(0x10371a0, 0xc00007c008, 0x0)
        go/src/runtime/debug/stack.go:24 +0xa4
cmd/compile/internal/gc.Fatalf(0xc000010300, 0x32, 0xc00041a000, 0x5, 0x5)
        go/src/cmd/compile/internal/gc/subr.go:190 +0x29a
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc0003e8000, 0x80a000000002, 0xe9d789, 0x2c, 0xc00003a300, 0x4, 0x4)
        go/src/cmd/compile/internal/gc/ssa.go:5855 +0x1b8
cmd/compile/internal/ssa.(*Func).Fatalf(...)
        go/src/cmd/compile/internal/ssa/func.go:577
cmd/compile/internal/ssa.Compile.func1(0xc0003fb108, 0xc0003ea000)
        go/src/cmd/compile/internal/ssa/compile.go:47 +0x226
panic(0xdef300, 0x102bad0)
        go/src/runtime/panic.go:532 +0x1c3
cmd/compile/internal/ssa.arm64Negate(...)
        go/src/cmd/compile/internal/ssa/rewrite.go:734
cmd/compile/internal/ssa.rewriteValueARM64_OpARM64CSEL_0(0xc00034c620, 0x0)
        go/src/cmd/compile/internal/ssa/rewriteARM64.go:4530 +0xa7b
cmd/compile/internal/ssa.rewriteValueARM64(0xc00034c620, 0x0)
        go/src/cmd/compile/internal/ssa/rewriteARM64.go:77 +0x1d1e
cmd/compile/internal/ssa.applyRewrite(0xc0003ea000, 0xea8f90, 0xea8ff8)
        go/src/cmd/compile/internal/ssa/rewrite.go:80 +0x366
cmd/compile/internal/ssa.lower(0xc0003ea000)
        go/src/cmd/compile/internal/ssa/lower.go:10 +0x4d
cmd/compile/internal/ssa.Compile(0xc0003ea000)
        go/src/cmd/compile/internal/ssa/compile.go:90 +0x480
cmd/compile/internal/gc.buildssa(0xc0000c42c0, 0x0, 0x0)
        go/src/cmd/compile/internal/gc/ssa.go:234 +0xc04
cmd/compile/internal/gc.compileSSA(0xc0000c42c0, 0x0)
        go/src/cmd/compile/internal/gc/pgen.go:297 +0x54
cmd/compile/internal/gc.compileFunctions.func2(0xc000345e00, 0xc000054a10, 0x0)
        go/src/cmd/compile/internal/gc/pgen.go:362 +0x50
created by cmd/compile/internal/gc.compileFunctions
        go/src/cmd/compile/internal/gc/pgen.go:360 +0x130

It compiles fine in go1.12.

@ALTree ALTree added this to the Go1.13 milestone Mar 8, 2019

@ALTree

This comment has been minimized.

Copy link
Member Author

commented Mar 8, 2019

The crash was bisected to the recently committed 6efd51c (cmd/compile: change the condition flags of floating-point comparisons in arm64 backend).

cc @zhangfannie @cherrymui

@cherrymui

This comment has been minimized.

Copy link
Contributor

commented Mar 8, 2019

As this issue demonstrates, rewrite.go (arm64Negate, arm64Invert, and perhaps ccARM64Eval) does need to handle the new Ops. @zhangfannie do you want to send a fix?

@zhangfannie

This comment has been minimized.

Copy link
Contributor

commented Mar 11, 2019

@cherrymui ok, I will take a look.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 11, 2019

Change https://golang.org/cl/166579 mentions this issue: cmd/compile: add handling for new floating-point comparisons flags

@gopherbot gopherbot closed this in a85afef Mar 12, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.