1
0
mirror of https://github.com/golang/go synced 2024-11-19 04:44:41 -07:00
go/test/fixedbugs/issue57955.go
Cherry Mui fdb3dc471d cmd/internal/obj/arm: handle HAUTO etc. in addpool
HAUTO should be handled the same way as other stack offsets for
adding to constant pool. Add the missing cases.

Fixes #57955.

Change-Id: If7fc82cafb2bbf0a6121e73e353b8825cb36b5bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/463138
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
2023-06-01 19:29:08 +00:00

44 lines
794 B
Go

// compile
// Copyright 2023 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Issue 57955: ARM assembler fails to handle certain cases.
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("")
}
}