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: illegal combination 02044 #57955

Closed
elagergren-spideroak opened this issue Jan 23, 2023 · 13 comments
Closed

cmd/compile: illegal combination 02044 #57955

elagergren-spideroak opened this issue Jan 23, 2023 · 13 comments
Assignees
Labels
arch-arm Issues solely affecting the 32-bit arm architecture. compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@elagergren-spideroak
Copy link

elagergren-spideroak commented Jan 23, 2023

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

$ go version
go version go1.19.3 linux/arm

Can also repro on 1.19.5.

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm"
GOBIN=""
GOCACHE="/home/pi/.cache/go-build"
GOENV="/home/pi/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/pi/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/pi/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_arm"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOARM="6"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/path/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1078720696=/tmp/go-build -gno-record-gcc-switches"

What did you do?

It's a large type switch:

func Decode[T any](b []byte) (T, int) {
    switch any(*new(T)).(type) {
    case int:
        v, n := DecodeInt(b)
        return any(v).(T), n
    case int8:
        v, n := DecodeInt8(b)
        return any(v).(T), n
    case int16:
        v, n := DecodeUint16(b)
        return any(v).(T), n
   // Elided for brevity
   case uint:
        v, n := DecodeUint(b)
        return any(v).(T), n
   case uint8:
        v, n := DecodeUint8(b)
        return any(v).(T), n
   case uint16:
        v, n := DecodeUint16(b)
        return any(v).(T), n
   // More cases, about 30 total.
}

The source code is not public (yet) and I haven't been able to create a minimal repro. I can provide the source code privately for debugging purposes, though.

When I comment out both the int16 and uint16 cases it works.

What did you expect to see?

It compile.

What did you see instead?

illegal combination 02044 (/path/decode.go:817) WORD package-path..autotmp_151-286(SP); NONE NONE HAUTO; from 0 0; to 3 3
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 23, 2023
@elagergren-spideroak elagergren-spideroak changed the title cmd/compile: illegal combination 02044 (/home/pi/postcard/pcwire/decode.go:817) WORD path..autotmp_151-286(SP); NONE NONE HAUTO; from 0 0; to 3 3 cmd/compile: illegal combination 02044 (path/decode.go:817) WORD path..autotmp_151-286(SP); NONE NONE HAUTO; from 0 0; to 3 3 Jan 23, 2023
@elagergren-spideroak elagergren-spideroak changed the title cmd/compile: illegal combination 02044 (path/decode.go:817) WORD path..autotmp_151-286(SP); NONE NONE HAUTO; from 0 0; to 3 3 cmd/compile: illegal combination 02044 Jan 23, 2023
@elagergren-spideroak
Copy link
Author

I can repro with 1.20rc3. Same error.

@randall77 randall77 added the arch-arm Issues solely affecting the 32-bit arm architecture. label Jan 23, 2023
@randall77
Copy link
Contributor

Weird, this is basically an assembler failure. It would really help to get a reproducer.

@randall77
Copy link
Contributor

@golang/arm

@elagergren-spideroak
Copy link
Author

@randall77 I can e-mail you the code if you'd like. Or I believe I can invite you to the repo. It's not secret, we just haven't decided on a license yet.

@randall77
Copy link
Contributor

There is no hurry. If it's going to be available soon (before May 1, say) then we can wait. If not, then try to get a standalone reproducer. Even if we could look at private code, it makes it hard to, e.g., write a test case that we can submit into the public repo.

In any case, I don't think I'm the one to look at this. I don't know much about the arm assembler.

@cherrymui
Copy link
Member

It looks to me that this switch https://cs.opensource.google/go/go/+/master:src/cmd/internal/obj/arm/asm5.go;l=691 may miss a case for HAUTO (and a few others). I'll send a CL for you to try. A reproducer may still be good. Thanks.

@gopherbot
Copy link

Change https://go.dev/cl/463138 mentions this issue: cmd/internal/obj/arm: handle HAUTO etc. in addpool

@cherrymui
Copy link
Member

@elagergren-spideroak could you try if CL https://golang.org/cl/463138 helps? (You'll need to build the Go toolchain with that patch applied.) Thanks.

@elagergren-spideroak
Copy link
Author

@cherrymui yup, that fixes it! Tested with go version devel go1.21-99d8ecd997 Mon Jan 23 13:33:04 2023 -0500 linux/arm (gotip download 463138).

@mknyszek mknyszek added this to the Backlog milestone Jan 30, 2023
@mknyszek mknyszek modified the milestones: Backlog, Go1.21 Jan 30, 2023
@cherrymui
Copy link
Member

@elagergren-spideroak could you share a more complete repro so we can have a test case? Thanks.

@elagergren-spideroak
Copy link
Author

@cherrymui I am working on a minimal repro. It might not be perfectly minimal, though. Sorry in advance.

@elagergren-spideroak
Copy link
Author

@cherrymui okay, it's pretty minimal:

package main

func main() {
	Decode[int16](nil)
	Decode[uint16](nil)
	Decode[float64](nil)
}

func DecodeInt16(b []byte) (int16, int) {
	return 0, 0
}

func DecodeUint16(b []byte) (uint16, int) {
	return 0, 0
}

func DecodeFloat64(b []byte) (float64, int) {
	return 0, 0
}

func Decode[T any](b []byte) (T, int) {
	switch any(*new(T)).(type) {
	case int16:
		v, n := DecodeInt16(b)
		return any(v).(T), n
	case uint16:
		v, n := DecodeUint16(b)
		return any(v).(T), n
	case float64:
		v, n := DecodeFloat64(b)
		return any(v).(T), n
	default:
		panic("")
	}
}
$ go version
go version go1.19.1 linux/arm
$ go run main.go
# command-line-arguments
./main.go:33:8: illegal combination 00344 (/tmp/main.go:21)	WORD	main..autotmp_25-2(SP); NONE NONE HAUTO; from 0 0; to 3 3
$ go1.19.3 run main.go
# command-line-arguments
./main.go:33:8: illegal combination 00344 (/tmp/main.go:21)	WORD	main..autotmp_25-2(SP); NONE NONE HAUTO; from 0 0; to 3 3

@cherrymui
Copy link
Member

Thanks. Added to the CL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-arm Issues solely affecting the 32-bit arm architecture. compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

5 participants