Skip to content

cmd/compile: internal compiler error: panic during layout #23504

Closed
@ALTree

Description

@ALTree
$ gotip version
go version devel +6104939432 Sun Jan 21 04:56:36 2018 +0000 linux/amd64

The following program:

package p

func f() {
	var B bool
	B2 := (B || B && !B) && !B
	B3 := B2 || B
	for (B3 || B2) && !B2 && B {
	}
}

crashes the go1.6, go1.7, go1.8, go1.9, and tip compilers with the following error:

# command-line-arguments
./prog.go:7:2: internal compiler error: panic during layout while compiling f:

runtime error: index out of range

goroutine 18 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc420359288, 0xc42035c140)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:38 +0xc8
panic(0xbbb7e0, 0xf9c810)
	/home/adonizetti/go/src/runtime/panic.go:502 +0x229
cmd/compile/internal/ssa.layout(0xc42035c140)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/layout.go:68 +0xdca
cmd/compile/internal/ssa.Compile(0xc42035c140)
	/home/adonizetti/go/src/cmd/compile/internal/ssa/compile.go:70 +0x2bb
cmd/compile/internal/gc.buildssa(0xc420001200, 0x0, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/ssa.go:223 +0xb32
cmd/compile/internal/gc.compileSSA(0xc420001200, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:239 +0x39
cmd/compile/internal/gc.compileFunctions.func2(0xc4204a83c0, 0xc420492090, 0x0)
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:289 +0x49
created by cmd/compile/internal/gc.compileFunctions
	/home/adonizetti/go/src/cmd/compile/internal/gc/pgen.go:287 +0x11c

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions