Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: internal compiler error: panic during short circuit #33903

Closed
ALTree opened this issue Aug 28, 2019 · 4 comments
Closed

cmd/compile: internal compiler error: panic during short circuit #33903

ALTree opened this issue Aug 28, 2019 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Aug 28, 2019

$ gotip version
go version devel +7be97af2ff Wed Aug 28 05:55:52 2019 +0000 windows/amd64

The following program:

package p

func f() {
        var p, q bool
        for {
                p = p && q
        }
}

Crashes the tip compiler with the following error:

$ gotip tool compile crash.go
crash.go:5:2: internal compiler error: 'f': panic during short circuit while compiling f:

runtime error: index out of range [2] with length 2

goroutine 1 [running]:
cmd/compile/internal/ssa.Compile.func1(0xc00008c728, 0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/compile.go:47 +0xac
panic(0xe1a8a0, 0xc000064b60)
        D:/users/ZZZZZ/alberto/other/temp/go/src/runtime/panic.go:679 +0x1c0
cmd/compile/internal/ssa.shortcircuitBlock(0xc000378e60, 0xc000000800)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/shortcircuit.go:160 +0x5f7
cmd/compile/internal/ssa.shortcircuit(0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/shortcircuit.go:69 +0x364
cmd/compile/internal/ssa.Compile(0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/compile.go:92 +0x99b
cmd/compile/internal/gc.buildssa(0xc0002bc160, 0x0, 0x0)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/ssa.go:289 +0xc15
cmd/compile/internal/gc.compileSSA(0xc0002bc160, 0x0)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:298 +0x54
cmd/compile/internal/gc.compile(0xc0002bc160)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:277 +0x33b
cmd/compile/internal/gc.funccompile(0xc0002bc160)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:222 +0xc8
cmd/compile/internal/gc.Main(0xe74da8)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/main.go:685 +0x31de
main.main()
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/main.go:51 +0xb3

goroutine 1 [running]:
runtime/debug.Stack(0xff6be0, 0xc000090008, 0x0)
        D:/users/ZZZZZ/alberto/other/temp/go/src/runtime/debug/stack.go:24 +0xa4
cmd/compile/internal/gc.Fatalf(0xc00007c140, 0x32, 0xc00009c4b0, 0x5, 0x5)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/subr.go:188 +0x298
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc00006d8f0, 0x502100000002, 0xe6a2b2, 0x2c, 0xc000314c00, 0x4, 0x4)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/ssa.go:6159 +0x1b7
cmd/compile/internal/ssa.(*Func).Fatalf(...)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/func.go:617
cmd/compile/internal/ssa.Compile.func1(0xc00008c728, 0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/compile.go:49 +0x21d
panic(0xe1a8a0, 0xc000064b60)
        D:/users/ZZZZZ/alberto/other/temp/go/src/runtime/panic.go:679 +0x1c0
cmd/compile/internal/ssa.shortcircuitBlock(0xc000378e60, 0xc000000800)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/shortcircuit.go:160 +0x5f7
cmd/compile/internal/ssa.shortcircuit(0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/shortcircuit.go:69 +0x364
cmd/compile/internal/ssa.Compile(0xc0002bc580)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/ssa/compile.go:92 +0x99b
cmd/compile/internal/gc.buildssa(0xc0002bc160, 0x0, 0x0)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/ssa.go:289 +0xc15
cmd/compile/internal/gc.compileSSA(0xc0002bc160, 0x0)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:298 +0x54
cmd/compile/internal/gc.compile(0xc0002bc160)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:277 +0x33b
cmd/compile/internal/gc.funccompile(0xc0002bc160)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/pgen.go:222 +0xc8
cmd/compile/internal/gc.Main(0xe74da8)
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/internal/gc/main.go:685 +0x31de
main.main()
        D:/users/ZZZZZ/alberto/other/temp/go/src/cmd/compile/main.go:51 +0xb3

It compiles fine on go1.12.5.

@ALTree ALTree added this to the Go1.14 milestone Aug 28, 2019
@ALTree ALTree added release-blocker NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Aug 28, 2019
@ALTree
Copy link
Member Author

ALTree commented Aug 28, 2019

It appears that the issue was introduced in the recently committed 52ae04f (cmd/compile: improve shortcircuit pass).

cc @josharian

@bcmills
Copy link
Contributor

bcmills commented Aug 28, 2019

CC @randall77

@josharian
Copy link
Contributor

Thanks! I’ll look soon.

@gopherbot
Copy link

Change https://golang.org/cl/192144 mentions this issue: cmd/compile: handle infinite loops in shortcircuit pass

tomocy pushed a commit to tomocy/go that referenced this issue Sep 1, 2019
The newly upgraded shortcircuit pass attempted to remove infinite loops.
Stop doing that.

Fixes golang#33903

Change-Id: I0fc9c1b5f2427e54ce650806602ef5e3ad65aca5
Reviewed-on: https://go-review.googlesource.com/c/go/+/192144
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
t4n6a1ka pushed a commit to t4n6a1ka/go that referenced this issue Sep 5, 2019
The newly upgraded shortcircuit pass attempted to remove infinite loops.
Stop doing that.

Fixes golang#33903

Change-Id: I0fc9c1b5f2427e54ce650806602ef5e3ad65aca5
Reviewed-on: https://go-review.googlesource.com/c/go/+/192144
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
@golang golang locked and limited conversation to collaborators Aug 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants