Skip to content

cmd/compile/internal/ssa: "panic during regalloc" on linux/ppc64* #52924

Open

Description

@bcmills
#!watchflakes
post <- goarch ~ `ppc64.*` && log ~ `panic during regalloc` && log ~ `^\s*cmd/compile/internal/ssa`

greplogs -l -e '(?ms)panic during regalloc .*cmd/compile/internal/ssa\.\(\*sparseSet\)\.add'
2022-05-13T21:33:25-4170084/linux-ppc64le-power9osu

(attn @randall77 @dr2chase @cherrymui; CC @golang/ppc64)

Activity

  1. bcmills commented on May 16, 2022

    @bcmills
    ContributorAuthor
    # encoding/json [encoding/json.test]
    go/src/encoding/json/decode_test.go:2438:70: internal compiler error: 'TestUnmarshalRescanLiteralMangledUnquote': panic during regalloc while compiling TestUnmarshalRescanLiteralMangledUnquote:
    
    runtime error: invalid memory address or nil pointer dereference
    
    goroutine 46 [running]:
    cmd/compile/internal/ssa.Compile.func1()
    	/workdir/go/src/cmd/compile/internal/ssa/compile.go:50 +0x7c
    panic({0x85e800, 0xebf7c0})
    	/workdir/go/src/runtime/panic.go:882 +0x238
    cmd/compile/internal/ssa.(*sparseSet).add(...)
    	/workdir/go/src/cmd/compile/internal/ssa/sparseset.go:39
    cmd/compile/internal/ssa.(*sparseSet).addAll(...)
    	/workdir/go/src/cmd/compile/internal/ssa/sparseset.go:45
    cmd/compile/internal/ssa.(*stackAllocState).computeLive(0xc0029394a0?, {0xc000f50c00?, 0x38?, 0x203030203030302?})
    	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:367 +0xe38
    cmd/compile/internal/ssa.(*stackAllocState).init(0xc0029394a0, 0xc0010101c0, {0xc000f50c00, 0x38, 0x38})
    	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:126 +0x150
    cmd/compile/internal/ssa.stackalloc(0xc0010101c0, {0xc000f50c00, 0x38, 0x38})
    	/workdir/go/src/cmd/compile/internal/ssa/stackalloc.go:88 +0x124
    cmd/compile/internal/ssa.(*regAllocState).regalloc(0xc001154180, 0xc0010101c0)
    	/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:1833 +0x1f8
    cmd/compile/internal/ssa.regalloc(0xc0010101c0?)
    	/workdir/go/src/cmd/compile/internal/ssa/regalloc.go:148 +0x50
    cmd/compile/internal/ssa.Compile(0xc0010101c0)
    	/workdir/go/src/cmd/compile/internal/ssa/compile.go:98 +0x928
    cmd/compile/internal/ssagen.buildssa(0xc0012717c0, 0x0)
    	/workdir/go/src/cmd/compile/internal/ssagen/ssa.go:574 +0x1468
    cmd/compile/internal/ssagen.Compile(0xc0012717c0, 0x0?)
    	/workdir/go/src/cmd/compile/internal/ssagen/pgen.go:183 +0x48
    cmd/compile/internal/gc.compileFunctions.func4.1(0x0?)
    	/workdir/go/src/cmd/compile/internal/gc/compile.go:153 +0x4c
    cmd/compile/internal/gc.compileFunctions.func3.1()
    	/workdir/go/src/cmd/compile/internal/gc/compile.go:140 +0x54
    created by cmd/compile/internal/gc.compileFunctions.func3
    	/workdir/go/src/cmd/compile/internal/gc/compile.go:138 +0x8c
    
  2. bcmills commented on May 16, 2022

    @bcmills
    ContributorAuthor

    There have been several changes in stackalloc.go during the Go 1.19 cycle, so marking as release-blocker at least until we can determine whether this is a regression.

  3. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on May 16, 2022
  4. added this to the Go1.19 milestone on May 16, 2022
  5. dr2chase commented on May 16, 2022

    @dr2chase
    Contributor

    It doesn't fail using the obvious cross-compilation:

    GOOS=linux GOARCH=ppc64le go test -c encoding/json
    

    which means, something wrong in that compiler?
    About to try it on a gomote....

  6. bcmills commented on May 16, 2022

    @bcmills
    ContributorAuthor

    It only failed once in the builder — looks like a nondeterministic failure.

    My guesses would be either a race or (given the ssa package) a runtime bug involving a mishandled OOM condition.

  7. dr2chase commented on May 16, 2022

    @dr2chase
    Contributor

    Oh joy. I've already verified that it doesn't reproduce (once) with

    GOPPC64=power9 GOOS=linux GOARCH=ppc64le go test -c encoding/json
    

    nor (once) on a plain ppc64le gomote.

  8. dr2chase commented on May 16, 2022

    @dr2chase
    Contributor

    On the failing builder, with a normally built compiler

    for i in {1..100} ; do  go clean -cache ; go test -c encoding/json ; echo $i done ; done
    

    over lunch worked fine.
    Am about to retry with GOPPC64=power9 built compiler.

  9. ceseo commented on May 16, 2022

    @ceseo
    Contributor

    I can't reproduce it either (POWER9, with either GOPPC=power9 and GOPPC=power8.

  10. cherrymui commented on May 27, 2022

    @cherrymui
    Member

    There have been several changes in stackalloc.go during the Go 1.19 cycle

    I don't think we have recent changes in stackalloc.go. The most recent change I saw is https://go-review.googlesource.com/c/go/+/312292 , which is a year old.

    I also built the compiler in race mode on PPC64LE and couldn't find a race or a crash in a reasonable amount of time.

    Given the above, and it does not occur on a first class port, I think it is not a release blocker. Thanks.

  11. ianlancetaylor commented on Jun 24, 2022

    @ianlancetaylor
    Contributor

    As far as I can see this has happened exactly once.

    Rolling forward to 1.20, but if it doesn't happen again we can close this.

  12. removed this from the Go1.19 milestone on Jun 24, 2022
  13. 17 remaining items

  14. pmur commented on Jan 10, 2024

    @pmur
    Contributor

    I suspect the most recent flake here is another manifestation of #64290. The failed index is 0x80346d1, and if the high bit is cleared, the index is valid.

  15. modified the milestones: Go1.22, Go1.23 on Feb 6, 2024
  16. modified the milestones: Go1.23, Go1.24 on Aug 13, 2024
  17. modified the milestones: Go1.24, Go1.25 on Feb 11, 2025
  18. modified the milestones: Go1.25, Go1.26 on Aug 12, 2025
  19. modified the milestones: Go1.26, Go1.27 on Feb 10, 2026
  20. modified the milestones: Go1.27, Go1.28 on Aug 19, 2026
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

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-ppc64xcompiler/runtimeIssues related to the Go compiler and/or runtime.help wanted

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions