Skip to content

go/types: assertion failure in expr.go:978 (Checker.rawExpr) #20837

Closed
@griesemer

Description

@griesemer

To reproduce:

  1. On top of commit e6d9eda2fc13786c55292429b510128252ad8817, apply
    https://go-review.googlesource.com/#/c/43512/:
    git fetch https://go.googlesource.com/go refs/changes/12/43512/8 && git cherry-pick FETCH_HEAD

  2. cd $GOROOT/src; GOOS=linux GOARCH=s390x CGO_ENABLED=0 go tool vet -unsafeptr=false -source archive/zip

Crash (after augmenting go/types to print a bit more information):

vet: import failed: type-checking package "fmt" failed (/Users/gri/go/src/fmt/print.go:10:2: could not import os (type-checking package "os" failed (/Users/gri/go/src/os/dir_unix.go:12:2: could not import syscall (type-checking package "syscall" failed (/Users/gri/go/src/syscall/zerrors_linux_s390x.go:889:2: PR_CAP_AMBIENT redeclared in this block)))))
vet: import failed: type-checking package "fmt" failed (/Users/gri/go/src/fmt/print.go:10:2: could not import os (type-checking package "os" failed (/Users/gri/go/src/os/dir_unix.go:12:2: could not import syscall (type-checking package "syscall" failed (/Users/gri/go/src/syscall/zerrors_linux_s390x.go:889:2: PR_CAP_AMBIENT redeclared in this block)))))
vet: import failed: type-checking package "net/http" failed (/Users/gri/go/src/net/http/client.go:13:2: could not import crypto/tls (type-checking package "crypto/tls" failed (/Users/gri/go/src/crypto/tls/cipher_suites.go:15:2: could not import crypto/x509 (type-checking package "crypto/x509" failed (/Users/gri/go/src/crypto/x509/pem_decrypt.go:16:2: could not import encoding/hex (type-checking package "encoding/hex" failed (/Users/gri/go/src/encoding/hex/hex.go:11:2: could not import fmt (type-checking package "fmt" failed (/Users/gri/go/src/fmt/print.go:10:2: could not import os (type-checking package "os" failed (/Users/gri/go/src/os/dir_unix.go:12:2: could not import syscall (type-checking package "syscall" failed (/Users/gri/go/src/syscall/zerrors_linux_s390x.go:889:2: PR_CAP_AMBIENT redeclared in this block)))))))))))))
vet: import failed: type-checking package "net/http" failed (/Users/gri/go/src/net/http/client.go:13:2: could not import crypto/tls (type-checking package "crypto/tls" failed (/Users/gri/go/src/crypto/tls/cipher_suites.go:15:2: could not import crypto/x509 (type-checking package "crypto/x509" failed (/Users/gri/go/src/crypto/x509/pem_decrypt.go:16:2: could not import encoding/hex (type-checking package "encoding/hex" failed (/Users/gri/go/src/encoding/hex/hex.go:11:2: could not import fmt (type-checking package "fmt" failed (/Users/gri/go/src/fmt/print.go:10:2: could not import os (type-checking package "os" failed (/Users/gri/go/src/os/dir_unix.go:12:2: could not import syscall (type-checking package "syscall" failed (/Users/gri/go/src/syscall/zerrors_linux_s390x.go:889:2: PR_CAP_AMBIENT redeclared in this block)))))))))))))
PANIC archive/zip/reader_test.go:372:17: time.Parse (kind = 1)
panic: archive/zip/reader_test.go:372:17: &{time Parse} (kind = 1)
 [recovered]
	panic: archive/zip/reader_test.go:372:17: &{time Parse} (kind = 1)


goroutine 1 [running]:
go/types.(*Checker).handleBailout(0xc4200fe540, 0xc42133d580)
	/Users/gri/go/src/go/types/check.go:225 +0xa4
panic(0x1274a20, 0xc420bb8080)
	/Users/gri/go/src/runtime/panic.go:491 +0x283
go/types.(*Checker).rawExpr(0xc4200fe540, 0xc4207238c0, 0x1418be0, 0xc4201e69a0, 0x0, 0x0, 0xc42133afa0)
	/Users/gri/go/src/go/types/expr.go:978 +0x6dd
go/types.(*Checker).exprOrType(0xc4200fe540, 0xc4207238c0, 0x1418be0, 0xc4201e69a0)
	/Users/gri/go/src/go/types/expr.go:1576 +0x5f
go/types.(*Checker).call(0xc4200fe540, 0xc4207238c0, 0xc4201e4840, 0x0)
	/Users/gri/go/src/go/types/call.go:15 +0x66
go/types.(*Checker).exprInternal(0xc4200fe540, 0xc4207238c0, 0x14184a0, 0xc4201e4840, 0x0, 0x0, 0xc42133b6d0)
	/Users/gri/go/src/go/types/expr.go:1427 +0x1d21
go/types.(*Checker).rawExpr(0xc4200fe540, 0xc4207238c0, 0x14184a0, 0xc4201e4840, 0x0, 0x0, 0x0)
	/Users/gri/go/src/go/types/expr.go:959 +0x84
go/types.(*Checker).multiExpr(0xc4200fe540, 0xc4207238c0, 0x14184a0, 0xc4201e4840)
	/Users/gri/go/src/go/types/expr.go:1533 +0x62
go/types.(*Checker).initVars.func1(0xc4207238c0, 0x0)
	/Users/gri/go/src/go/types/assignments.go:206 +0x5d
go/types.unpack(0xc42133ba00, 0x1, 0x1, 0x1076c84, 0xc420193c9a, 0x0)
	/Users/gri/go/src/go/types/call.go:140 +0x6a
go/types.(*Checker).initVars(0xc4200fe540, 0xc420bb8040, 0x2, 0x2, 0xc4201e29d0, 0x1, 0x1, 0x0)
	/Users/gri/go/src/go/types/assignments.go:206 +0xf9
go/types.(*Checker).shortVarDecl(0xc4200fe540, 0xb77f, 0xc4201e6940, 0x2, 0x2, 0xc4201e29d0, 0x1, 0x1)
	/Users/gri/go/src/go/types/assignments.go:316 +0x878
go/types.(*Checker).stmt(0xc4200fe540, 0x0, 0x14182a0, 0xc4201e4880)
	/Users/gri/go/src/go/types/stmt.go:391 +0x3763
go/types.(*Checker).stmtList(0xc4200fe540, 0x0, 0xc4201e4ac0, 0x3, 0x4)
	/Users/gri/go/src/go/types/stmt.go:110 +0x88
go/types.(*Checker).stmt(0xc4200fe540, 0x0, 0x1418420, 0xc4201e84b0)
	/Users/gri/go/src/go/types/stmt.go:477 +0x4041
go/types.(*Checker).stmt(0xc4200fe540, 0x0, 0x14188e0, 0xc4201e4b00)
	/Users/gri/go/src/go/types/stmt.go:489 +0x424a
go/types.(*Checker).stmtList(0xc4200fe540, 0x0, 0xc4201de200, 0x12, 0x20)
	/Users/gri/go/src/go/types/stmt.go:110 +0x88
go/types.(*Checker).funcBody(0xc4200fe540, 0xc421cb6cc0, 0xc420193c30, 0xc, 0xc420a2ce40, 0xc4201e8ff0)
	/Users/gri/go/src/go/types/stmt.go:42 +0x18d
go/types.(*Checker).functionBodies(0xc4200fe540)
	/Users/gri/go/src/go/types/resolver.go:476 +0xdb
go/types.(*Checker).checkFiles(0xc4200fe540, 0xc42020ac80, 0x7, 0x8, 0x0, 0x0)
	/Users/gri/go/src/go/types/check.go:241 +0xcb
go/types.(*Checker).Files(0xc4200fe540, 0xc42020ac80, 0x7, 0x8, 0xc420dc54d0, 0x0)
	/Users/gri/go/src/go/types/check.go:230 +0x49
go/types.(*Config).Check(0xc421158580, 0xc42008cbd0, 0x3, 0xc42008f4c0, 0xc42020ac80, 0x7, 0x8, 0xc4205371d0, 0x111e70d, 0x12b89e0, ...)
	/Users/gri/go/src/go/types/api.go:351 +0x1b3
main.(*Package).check(0xc420272600, 0xc42008f4c0, 0xc42020ac80, 0x7, 0x8, 0x0, 0xc420288580)
	/Users/gri/go/src/cmd/vet/types.go:93 +0x37d
main.doPackage(0x7fff5fbffb51, 0xb, 0xc4200a8b80, 0x7, 0x8, 0x0, 0x0)
	/Users/gri/go/src/cmd/vet/main.go:351 +0x919
main.doPackageDir(0x7fff5fbffb51, 0xb)
	/Users/gri/go/src/cmd/vet/main.go:293 +0x586
main.visit(0x7fff5fbffb51, 0xb, 0x1419de0, 0xc4200856c0, 0x0, 0x0, 0x0, 0x0)
	/Users/gri/go/src/cmd/vet/main.go:386 +0xe6
path/filepath.walk(0x7fff5fbffb51, 0xb, 0x1419de0, 0xc4200856c0, 0x12e4c20, 0x0, 0xc420045e70)
	/Users/gri/go/src/path/filepath/path.go:356 +0x81
path/filepath.Walk(0x7fff5fbffb51, 0xb, 0x12e4c20, 0xc, 0xc4200855f0)
	/Users/gri/go/src/path/filepath/path.go:403 +0x11d
main.walkDir(0x7fff5fbffb51, 0xb)
	/Users/gri/go/src/cmd/vet/main.go:401 +0x41
main.main()
	/Users/gri/go/src/cmd/vet/main.go:249 +0x3c2

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions