Skip to content

cmd/compile: crash in make running generic code [1.18 backport] #52311

Closed as not planned

Description

@mier85

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

go version go1.18 linux/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/mier85/.cache/go-build"
GOENV="/home/mier85/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/mier85/go/pkg/mod"
GONOPROXY=
GONOSUMDB=
GOOS="linux"
GOPATH="/home/mier85/go"
GOPRIVATE=
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2488678595=/tmp/go-build -gno-record-gcc-switches"

What did you do?

https://go.dev/play/p/ys1JxRrYwce

What did you expect to see?

=== RUN   TestRunner
=== RUN   TestRunner/#00
[]string{"blubb"}--- PASS: TestRunner (0.00s)
    --- PASS: TestRunner/#00 (0.00s)
PASS

What did you see instead?

=== RUN   TestRunner
=== RUN   TestRunner/#00
--- FAIL: TestRunner (0.00s)
    --- FAIL: TestRunner/#00 (0.00s)
panic: runtime error: makeslice: cap out of range [recovered]
	panic: runtime error: makeslice: cap out of range

goroutine 19 [running]:
testing.tRunner.func1.2({0x4bf6a0, 0x4f7f00})
	/usr/local/go-faketime/src/testing/testing.go:1389 +0x24e
testing.tRunner.func1()
	/usr/local/go-faketime/src/testing/testing.go:1392 +0x39f
panic({0x4bf6a0, 0x4f7f00})
	/usr/local/go-faketime/src/runtime/panic.go:838 +0x207
strconv.appendQuotedWith({0xc0000a2c98, 0x0, 0x45b5d9?}, {0x2e676e6974736574, 0x72656e6e755274}, 0x22, 0x85?, 0x50?)
	/usr/local/go-faketime/src/strconv/quote.go:35 +0x86
strconv.AppendQuote(...)
	/usr/local/go-faketime/src/strconv/quote.go:135
fmt.(*fmt).fmtQ(0xc0000a2c70, {0x2e676e6974736574, 0x4bba80?})
	/usr/local/go-faketime/src/fmt/format.go:457 +0xe8
fmt.(*pp).fmtString(0x4bba80?, {0x2e676e6974736574?, 0x0?}, 0x0?)
	/usr/local/go-faketime/src/fmt/print.go:441 +0x7b
fmt.(*pp).printValue(0xc0000a2c30, {0x4bba80?, 0x508561?, 0x0?}, 0x76, 0x1)
	/usr/local/go-faketime/src/fmt/print.go:757 +0xf32
fmt.(*pp).printValue(0xc0000a2c30, {0x4ba400?, 0xc0000ac0a8?, 0x4aba33?}, 0x76, 0x0)
	/usr/local/go-faketime/src/fmt/print.go:856 +0x1615
fmt.(*pp).printArg(0xc0000a2c30, {0x4ba400?, 0xc0000ac0a8}, 0x76)
	/usr/local/go-faketime/src/fmt/print.go:712 +0x74c
fmt.(*pp).doPrintf(0xc0000a2c30, {0x4d2be5, 0x3}, {0xc000093f08?, 0x1, 0x1})
	/usr/local/go-faketime/src/fmt/print.go:1026 +0x288
fmt.Fprintf({0x4f8308, 0xc0000b2008}, {0x4d2be5, 0x3}, {0xc000038708, 0x1, 0x1})
	/usr/local/go-faketime/src/fmt/print.go:204 +0x75
fmt.Printf(...)
	/usr/local/go-faketime/src/fmt/print.go:213
main.Fixture.Run(...)
	/tmp/sandbox3516507230/prog.go:34
testing.tRunner(0xc000083040, 0xc0000ac078)
	/usr/local/go-faketime/src/testing/testing.go:1439 +0x102
created by testing.(*T).Run
	/usr/local/go-faketime/src/testing/testing.go:1486 +0x35f

Activity

  1. ianlancetaylor commented on Apr 12, 2022

    @ianlancetaylor
    Contributor

    This test works on tip, fails on Go 1.18 branch. A git bisect suggests that it was fixed by https://go.dev/cl/395594 which reverted https://go.dev/cl/378178. I'm not sure whether we should backport 395594 to the 1.18 branch.

    CC @randall77

  2. changed the title [-]testing + generics: issue with tRunner when running a generic[/-] [+]cmd/compile: crash in make running generic code[/+] on Apr 12, 2022
  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    CherryPickCandidateUsed during the release process for point releases
    on Apr 12, 2022
  4. added this to the Go1.18.2 milestone on Apr 12, 2022
  5. ianlancetaylor commented on Apr 12, 2022

    @ianlancetaylor
    Contributor

    Since this is fixed on tip, I'm marking this as a cherry pick candidate for 1.18.

  6. modified the milestones: Go1.18.2, Go1.18.3 on May 10, 2022
  7. heschi commented on May 11, 2022

    @heschi
    Contributor
  8. changed the title [-]cmd/compile: crash in make running generic code[/-] [+]cmd/compile: crash in make running generic code [1.18 backport][/+] on May 11, 2022
  9. toothrot commented on May 25, 2022

    @toothrot
    Contributor

    Any updates on this issue? @randall77

  10. modified the milestones: Go1.18.3, Go1.18.4 on Jun 1, 2022
  11. gopherbot commented on Jun 8, 2022

    @gopherbot
    Contributor

    Change https://go.dev/cl/411120 mentions this issue: [release-branch.go1.18] Revert "cmd/compile: stop interface conversions for generic method calls from allocating"

  12. cherrymui commented on Jun 8, 2022

    @cherrymui
    Member

    CL 395594 doesn't apply cleanly to the 1.18 branch, but the edit is small. I made https://go-review.googlesource.com/c/go/+/411120 , which does seem to fix the issue.

    @randall77 what do you think? Should we backport the reverting CL? Thanks.

  13. modified the milestones: Go1.18.4, Go1.18.5 on Jul 12, 2022
  14. cherrymui commented on Jul 27, 2022

    @cherrymui
    Member

    I think we are still unclear what the best fix it. Also, as we discussed in #53852 (comment) , we will stop backporting non-revert generics issues to 1.18, so we don't destabilize Go 1.18. Maybe we don't backport this one?

  15. added
    CherryPickCandidateUsed during the release process for point releases
    and removed
    CherryPickApprovedUsed during the release process for point releases
    on Jul 27, 2022
  16. modified the milestones: Go1.18.5, Go1.18.6 on Aug 1, 2022
  17. dmitshur commented on Aug 3, 2022

    @dmitshur
    Member

    We've discussed this backport request. It was found that backporting individual CLs for generic fixes can cause destabilization and create new issues, so because of that risk we're not going to accept this backport candidate. This problem doesn't exist in Go 1.19 and future major Go releases.

  18. locked and limited conversation to collaborators on Aug 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CherryPickCandidateUsed during the release process for point releasesFrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions