Skip to content

cmd/compile: yet another "internal compiler error: second walk of switch" #29562

@dr2chase

Description

@dr2chase

This is the result of an effort to root out all walked-a-node twice bugs.

What version of Go are you using (go version)?

go version go1.11 darwin/amd64

also tip

go version devel +23c22ca42c Fri Jan 4 05:11:30 2019 +0000 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/drchase/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/drchase/work/gocode"
GOPROXY=""
GORACE=""
GOROOT="/Users/drchase/work/go-quick"
GOTMPDIR=""
GOTOOLDIR="/Users/drchase/work/go-quick/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/gr/vvb66dqx6jl6lh8wckfd5p9w0095tn/T/go-build861431346=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

https://play.golang.org/p/0C-4ZutLsEc

Or go tool compile, with this input:

package p

func il(s string) string {
	switch len(s) {
	case 0:
		return "zero"
	case 1:
		return "one"
	}
	return s
}

func f() {
	var s string
	var as []string
	switch false && (s+"a"+as[0]+il(s)+as[0]+s == "") {
	}
}

What did you expect to see?

compilation

What did you see instead?

failure:

dwalkil.go:16:33: internal compiler error: second walk of switch

Metadata

Metadata

Assignees

No one assigned

    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