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: unhandled OCONV ARRAY -> UINT8 #52020

Closed
neild opened this issue Mar 29, 2022 · 6 comments
Closed

cmd/compile: internal compiler error: unhandled OCONV ARRAY -> UINT8 #52020

neild opened this issue Mar 29, 2022 · 6 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@neild
Copy link
Contributor

neild commented Mar 29, 2022

Compiler failure with tip:

$ go version
go version devel go1.19-a4a0f9b148 Tue Mar 29 18:55:09 2022 +0000 linux/amd64
package main

func main() {
        var _ interface{} = struct{ _ [1]int8 }{}
}
$ go run .
./main.go:4:41: internal compiler error: 'main': unhandled OCONV ARRAY -> UINT8

goroutine 49 [running]:
runtime/debug.Stack()
        /usr/local/google/home/dneil/src/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0xc7ca60?, 0x0?}, {0xc00042b8d0, 0x1e}, {0xc0007142d0, 0x3, 0x3})
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x0?, {0x0?, 0x0?}, {0xd0b605, 0x18}, {0xc00070c140, 0x2, 0x0?})
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:7676 +0x17d
cmd/compile/internal/ssagen.(*state).Fatalf(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:925
cmd/compile/internal/ssagen.(*state).conv(0xc0005c4100, {0xe63290, 0xc0007101e0}, 0x1?, 0xc0003e8bd0, 0xc00037e230)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2526 +0x1f49
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc0005c4100, {0xe63290?, 0xc0007101e0?}, 0x1)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2724 +0x1cda
cmd/compile/internal/ssagen.(*state).expr(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2532
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc0005c4100, {0xe63290?, 0xc000710230?}, 0x1)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2723 +0x1c8b
cmd/compile/internal/ssagen.(*state).expr(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2532
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc0005c4100, {0xe62c18?, 0xc000726060?}, 0x1)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2892 +0x49eb
cmd/compile/internal/ssagen.(*state).expr(0xc0005c4100?, {0xe62c18?, 0xc000726060?})
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2532 +0x28
cmd/compile/internal/ssagen.(*state).addr(0xc0005c4100, {0xe639c0, 0xc0007260c0})
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:5233 +0xbdf
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc0005c4100, {0xe62880?, 0xc000710320?}, 0x1)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2978 +0x154a
cmd/compile/internal/ssagen.(*state).expr(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2532
cmd/compile/internal/ssagen.(*state).exprCheckPtr(0xc0005c4100, {0xe62c18?, 0xc000726180?}, 0x1)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:3114 +0x693e
cmd/compile/internal/ssagen.(*state).expr(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:2532
cmd/compile/internal/ssagen.(*state).stmt(0xc0005c4100, {0xe62aa8, 0xc0003e6dc0?})
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:1581 +0xade
cmd/compile/internal/ssagen.(*state).stmtList(...)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:1371
cmd/compile/internal/ssagen.buildssa(0xc000405cc0, 0x0)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/ssa.go:554 +0x1ea9
cmd/compile/internal/ssagen.Compile(0xc000405cc0, 0xc0005bc790?)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/ssagen/pgen.go:183 +0x4c
cmd/compile/internal/gc.compileFunctions.func4.1(0x0?)
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/gc/compile.go:153 +0x3a
cmd/compile/internal/gc.compileFunctions.func3.1()
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/gc/compile.go:140 +0x4d
created by cmd/compile/internal/gc.compileFunctions.func3
        /usr/local/google/home/dneil/src/go/src/cmd/compile/internal/gc/compile.go:138 +0x78
@prattmic
Copy link
Member

My bisect blames:

3fd8b8627f39d34e1a66bf4d610784bcd3f4319d is the first bad commit
commit 3fd8b8627f39d34e1a66bf4d610784bcd3f4319d
Author: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Date:   Wed Dec 1 00:28:25 2021 +0700

    cmd/compile: handle sole component for 1-byte type interface conversion
    
    For 1-byte type, we have a special case for converting to interface
    type. But we missed an optimization for sole component-ed types, this CL
    add that one.
    
    goos: linux
    goarch: amd64
    cpu: 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
    Benchmark_BoolField-8           1000000000               0.6473 ns/op
    Benchmark_ByteField-8           1000000000               0.6094 ns/op
    Benchmark_Uint8Field-8          1000000000               0.6385 ns/op
    Benchmark_Int16Field-8          785179434                1.481 ns/op
    Benchmark_Int32Field-8          796127782                1.539 ns/op
    Benchmark_Int64Field-8          718815478                1.657 ns/op
    
    Fixes #49879
    
    Change-Id: Idc0e9d3ff738c8c8081b8e8d65093dacf2bcf392
    Reviewed-on: https://go-review.googlesource.com/c/go/+/367755
    Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
    Reviewed-by: Keith Randall <khr@golang.org>
    Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
    TryBot-Result: Gopher Robot <gobot@golang.org>

 src/cmd/compile/internal/types/type.go   |  1 +
 src/cmd/compile/internal/walk/convert.go | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 1 deletion(-)
bisect found first bad commit

https://go.dev/cl/367755

cc @cuonglm @randall77

@gopherbot
Copy link

Change https://go.dev/cl/396535 mentions this issue: Revert "cmd/compile: handle sole component for 1-byte type interface conversion"

@prattmic
Copy link
Member

I'm not familiar enough with this code to fix this, but the CL appears standalone, so I went ahead and sent a revert as https://go.dev/cl/396535 if we want to revert this while it gets fixed.

@odeke-em
Copy link
Member

@prattmic I've unblocked you and approved your CL, please go ahead and submit.

@cuonglm
Copy link
Member

cuonglm commented Mar 30, 2022

@prattmic I will send a fix shortly.

@cuonglm cuonglm added the NeedsFix The path to resolution is known, but the work has not been done. label Mar 30, 2022
@cuonglm cuonglm self-assigned this Mar 30, 2022
@gopherbot
Copy link

Change https://go.dev/cl/396614 mentions this issue: cmd/compile/internal/walk: fix wrong soleComponent implementation

@cuonglm cuonglm added this to the Go1.19 milestone Mar 30, 2022
@rsc rsc unassigned cuonglm Jun 22, 2022
@golang golang locked and limited conversation to collaborators Jun 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants