Skip to content

cmd/compile: internal compiler error: OXDOT in OuterValue #50437

@dsnet

Description

@dsnet

Git bisect reveals a regression stemming from https://go-review.googlesource.com/c/go/+/371554, where the following reproduction crashes with that change, but works just prior to that change.

Reproduction:

$ git clone https://github.com/go-json-experiment/json.git
$ cd json
$ git checkout arshal-funcs
$ go test -vet off# github.com/go-json-experiment/json_test [github.com/go-json-experiment/json.test]
./arshal_funcs_generic.go:50:15: internal compiler error: OXDOT in OuterValue: "github.com/go-json-experiment/json".a.fncCache

goroutine 1 [running]:
runtime/debug.Stack()
    go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x4e9ea2?, 0x0?}, {0xd29d8d, 0x17}, {0xc000619988, 0x1, 0x1})
    go/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/ir.OuterValue({0xe944a0?, 0xc0006307e0?})
    go/src/cmd/compile/internal/ir/node.go:587 +0x1f3
cmd/compile/internal/typecheck.markAddrOf({0xe944a0?, 0xc0006307e0?})
    go/src/cmd/compile/internal/typecheck/subr.go:88 +0x4d
cmd/compile/internal/typecheck.NodAddrAt({0x74efc0?, 0xc0?}, {0xe944a0?, 0xc0006307e0?})
    go/src/cmd/compile/internal/typecheck/subr.go:75 +0x35
cmd/compile/internal/typecheck.(*importReader).node(0xc00074efc0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1637 +0x1190
cmd/compile/internal/typecheck.(*importReader).expr(0x0?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1285 +0x1d
cmd/compile/internal/typecheck.(*importReader).exprList(0xc00074efc0?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1275 +0x47
cmd/compile/internal/typecheck.(*importReader).node(0xc00074efc0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1585 +0x1cf4
cmd/compile/internal/typecheck.(*importReader).expr(0xce9900?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1285 +0x1d
cmd/compile/internal/typecheck.(*importReader).exprList(0xc00074efc0?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1275 +0x47
cmd/compile/internal/typecheck.(*importReader).node(0xc00074efc0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1722 +0x150a
cmd/compile/internal/typecheck.(*importReader).stmtList(0xc00074efc0?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1207 +0x58
cmd/compile/internal/typecheck.(*importReader).node(0xc00074efc0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1737 +0x212b
cmd/compile/internal/typecheck.(*importReader).stmtList(0x4?)
    go/src/cmd/compile/internal/typecheck/iimport.go:1207 +0x58
cmd/compile/internal/typecheck.(*importReader).funcBody(0xc00074efc0, 0xc00090c2c0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1128 +0xa5
cmd/compile/internal/typecheck.(*importReader).doInline(0xca0360?, 0xc00090c2c0)
    go/src/cmd/compile/internal/typecheck/iimport.go:1092 +0x99
cmd/compile/internal/typecheck.ImportBody(0xc00090c2c0)
    go/src/cmd/compile/internal/typecheck/iimport.go:80 +0x206
cmd/compile/internal/noder.checkFetchBody(0xc0008f7860)
    go/src/cmd/compile/internal/noder/stencil.go:638 +0x96
cmd/compile/internal/noder.(*genInst).getInstantiation(0x1390e00, 0xc0008f7860, {0xc00072c880, 0x2, 0x0?}, 0x0?)
    go/src/cmd/compile/internal/noder/stencil.go:659 +0x5a
cmd/compile/internal/noder.(*genInst).instantiateMethods(0x40d387?)
    go/src/cmd/compile/internal/noder/stencil.go:585 +0x24e
cmd/compile/internal/noder.(*genInst).buildInstantiations(0x1390e00, 0x0)
    go/src/cmd/compile/internal/noder/stencil.go:60 +0x3a
cmd/compile/internal/noder.BuildInstantiations(...)
    go/src/cmd/compile/internal/noder/stencil.go:47
cmd/compile/internal/gc.Main(0xd4bd08)
    go/src/cmd/compile/internal/gc/main.go:251 +0xd7c
main.main()
    go/src/cmd/compile/main.go:55 +0xdd

FAIL    github.com/go-json-experiment/json [build failed]

The code builds and runs fine with GOEXPERIMENT=unified:

$ GOEXPERIMENT=unified go.dev test -vet=off
PASS
ok      github.com/go-json-experiment/json  0.970s

\cc @randall77 @danscales @mdempsky

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.genericsIssue is related to generics

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions