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

Comments

@ALTree
Copy link
Member

@ALTree 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

This comment has been minimized.

Copy link
Member Author

@ALTree 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

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Aug 28, 2019

@josharian

This comment has been minimized.

Copy link
Contributor

@josharian josharian commented Aug 28, 2019

Thanks! I’ll look soon.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 28, 2019

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

@gopherbot gopherbot closed this in 2393d16 Aug 29, 2019
tomocy added 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 added 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.