Skip to content

internal compiler error: cannot export DCLTYPE (50) node #48217

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

Closed
Clemens-H opened this issue Sep 6, 2021 · 1 comment
Closed

internal compiler error: cannot export DCLTYPE (50) node #48217

Clemens-H opened this issue Sep 6, 2021 · 1 comment

Comments

@Clemens-H
Copy link

Clemens-H commented Sep 6, 2021

What version of Go are you using (go version)?

$ gotip version
go version devel go1.18-c7f09eeb13 Mon Sep 6 06:52:46 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

No, because it is related to generic functions.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="darwin"
[...]

What did you do?

Tried to compile:

func PMap[I, O any](inputs []I, f func(I) (O, error)) ([]O, error) {
	type item struct {
		output O
		err    error
	}

	items := make([]item, len(inputs))
	tokens := make(chan struct{}, runtime.NumCPU())
	wg := sync.WaitGroup{}
	wg.Add(len(inputs))
	for i, input := range inputs {
		go func(i int, input I) {
			defer wg.Done()
			tokens <- struct{}{}
			defer func() { <-tokens }()

			items[i].output, items[i].err = f(input)
		}(i, input)
	}
	wg.Wait()

	outputs := make([]O, len(inputs))
	for i, item := range items {
		if item.err != nil {
			return nil, item.err
		}

		outputs[i] = item.output
	}

	return outputs, nil
}

What did you expect to see?

A clean compile.

What did you see instead?

(Some pathnames elided.)

# testGenerics
<autogenerated>:1: internal compiler error: cannot export DCLTYPE (50) node
        ==> please file an issue and assign to gri@

goroutine 1 [running]:
runtime/debug.Stack()
        sdk/gotip/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x55d140, 0xc0}, {0x1913e43, 0x47}, {0xc0007e1690, 0x2, 0x2})
        sdk/gotip/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
        sdk/gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc00077cbd0, {0x1a62f78, 0xc00055d140})
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:2072 +0x19dd
cmd/compile/internal/typecheck.(*exportWriter).node(0xc0006c2c30, {0x1a62f78, 0xc00055d140})
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:1455 +0x7b
cmd/compile/internal/typecheck.(*exportWriter).stmtList(0xc00077cbd0, {0xc000526c00, 0xa, 0xc0006c2c30})
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:1446 +0x76
cmd/compile/internal/typecheck.(*exportWriter).funcBody(0xc00077cbd0, 0xc00055b600)
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:1441 +0x5b
cmd/compile/internal/typecheck.(*iexporter).doInline(0xc000622580, 0xc00058ef70)
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:632 +0xc5
cmd/compile/internal/typecheck.(*exportWriter).funcExt(0xc00077c930, 0xc00058ef70)
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:1378 +0x1b6
cmd/compile/internal/typecheck.(*iexporter).doDecl(0xc000622580, 0xc00058ef70)
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:503 +0x21e
cmd/compile/internal/typecheck.WriteExports({0x1a49a80, 0xc0006c23f0}, 0x1)
        sdk/gotip/src/cmd/compile/internal/typecheck/iexport.go:301 +0x2e5
cmd/compile/internal/noder.WriteExports(0xc00079e510)
        sdk/gotip/src/cmd/compile/internal/noder/export.go:40 +0x7a
cmd/compile/internal/gc.dumpCompilerObj(0xc00079e510)
        sdk/gotip/src/cmd/compile/internal/gc/obj.go:107 +0x28
cmd/compile/internal/gc.dumpobj1({0x7ffeefbff372, 0x4f}, 0x3)
        sdk/gotip/src/cmd/compile/internal/gc/obj.go:63 +0x17b
cmd/compile/internal/gc.dumpobj()
        sdk/gotip/src/cmd/compile/internal/gc/obj.go:44 +0x36
cmd/compile/internal/gc.Main(0x191b670)
        sdk/gotip/src/cmd/compile/internal/gc/main.go:329 +0x10ef
main.main()
        sdk/gotip/src/cmd/compile/main.go:55 +0xdd
@ALTree
Copy link
Member

ALTree commented Sep 6, 2021

Thanks for reporting this.

I believe this is already tracked at #47631. Closing here as a dup.

@ALTree ALTree closed this as completed Sep 6, 2021
@golang golang locked and limited conversation to collaborators Sep 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants