Skip to content

cmd/compile: "internal compiler error: width not calculated: interface {}" when building tiny program with -c=2 #20174

@ALTree

Description

@ALTree
$ gotip version
go version devel +cf1b323fc8 Sat Apr 29 15:56:48 2017 +0000 linux/amd64

The following program:

package p

func F() {
	_ = (*interface{})(nil)
	select {
	case _ = <-make(chan interface {
		M()
	}, 1):
	}

}

deterministically crashes the tip compiler when building with -gcflags -c=2 with the following error:

# command-line-arguments
<autogenerated>:1:0: internal compiler error: width not calculated: interface {}

goroutine 20 [running]:
runtime/debug.Stack(0x0, 0x0, 0x0)
	/home/alberto/go/src/runtime/debug/stack.go:24 +0x79
bootstrap/cmd/compile/internal/gc.Fatalf(0x96b862, 0x18, 0xc42003cc40, 0x1, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/subr.go:181 +0x24c
bootstrap/cmd/compile/internal/gc.dowidth(0xc4202ee3c0)
	/home/alberto/go/src/cmd/compile/internal/gc/align.go:192 +0xf86
bootstrap/cmd/compile/internal/types.(*Type).Fields(0xc4202ee3c0, 0xb81c40)
	/home/alberto/go/src/cmd/compile/internal/types/type.go:792 +0x84
bootstrap/cmd/compile/internal/types.(*Type).FieldSlice(0xc4202ee3c0, 0x0, 0x0, 0x0)
	/home/alberto/go/src/cmd/compile/internal/types/type.go:807 +0x2b
bootstrap/cmd/compile/internal/types.(*Type).cmp(0xc4202ee3c0, 0xc420336060, 0x59a300)
	/home/alberto/go/src/cmd/compile/internal/types/type.go:1040 +0xae1
bootstrap/cmd/compile/internal/types.(*Type).cmp(0xc420336000, 0xc420337200, 0xc4200da1c0)
	/home/alberto/go/src/cmd/compile/internal/types/type.go:1093 +0x4ce
bootstrap/cmd/compile/internal/types.(*Type).Compare(0xc420336000, 0xb81c40, 0xc420337200, 0xc4200863a8)
	/home/alberto/go/src/cmd/compile/internal/types/type.go:889 +0x69
bootstrap/cmd/compile/internal/ssa.(*Func).constVal(0xc4200c12c0, 0x80b00000002, 0x61c, 0xb81c40, 0xc420337200, 0xc759e285, 0xc42003d100, 0x8112ff)
	/home/alberto/go/src/cmd/compile/internal/ssa/func.go:413 +0x33b
bootstrap/cmd/compile/internal/ssa.(*Func).ConstNil(0xc4200c12c0, 0x80b00000002, 0xb81c40, 0xc420337200, 0x1)
	/home/alberto/go/src/cmd/compile/internal/ssa/func.go:475 +0x66
bootstrap/cmd/compile/internal/gc.(*state).constNil(0xc4200da1c0, 0xb81c40, 0xc420337200, 0xc4203371a0)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:472 +0x61
bootstrap/cmd/compile/internal/gc.(*state).expr(0xc4200da1c0, 0xc420330a00, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:1454 +0x9d9
bootstrap/cmd/compile/internal/gc.(*state).stmt(0xc4200da1c0, 0xc420330b00)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:707 +0x1d2
bootstrap/cmd/compile/internal/gc.(*state).stmtList(0xc4200da1c0, 0xc420310b00)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:511 +0x65
bootstrap/cmd/compile/internal/gc.(*state).call(0xc4200da1c0, 0xc420330880, 0xc4200da100, 0xc4203d35b8)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:3105 +0xfc
bootstrap/cmd/compile/internal/gc.(*state).stmt(0xc4200da1c0, 0xc420330880)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:544 +0x983
bootstrap/cmd/compile/internal/gc.(*state).stmtList(0xc4200da1c0, 0xc420310a80)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:511 +0x65
bootstrap/cmd/compile/internal/gc.(*state).stmt(0xc4200da1c0, 0xc42030d780)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:900 +0x1d21
bootstrap/cmd/compile/internal/gc.(*state).stmtList(0xc4200da1c0, 0xc420310960)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:511 +0x65
bootstrap/cmd/compile/internal/gc.buildssa(0xc4200c1180, 0x1, 0x0)
	/home/alberto/go/src/cmd/compile/internal/gc/ssa.go:197 +0x8c3
bootstrap/cmd/compile/internal/gc.compileSSA(0xc4200c1180, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:237 +0x39
bootstrap/cmd/compile/internal/gc.compileFunctions.func2(0xc4203373e0, 0xc42006d7b0, 0x1)
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:280 +0x74
created by bootstrap/cmd/compile/internal/gc.compileFunctions
	/home/alberto/go/src/cmd/compile/internal/gc/pgen.go:283 +0x115

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions