]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/internal/obj/arm: handle HAUTO etc. in addpool
authorCherry Mui <cherryyz@google.com>
Mon, 23 Jan 2023 18:31:00 +0000 (13:31 -0500)
committerCherry Mui <cherryyz@google.com>
Thu, 1 Jun 2023 19:29:08 +0000 (19:29 +0000)
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>

src/cmd/internal/obj/arm/asm5.go
test/fixedbugs/issue57955.go [new file with mode: 0644]

index 7b1682776e5316ad657f49a361329300eab6098c..177ffd979757553b597bfd1f302fd83889b8c51f 100644 (file)
@@ -688,13 +688,16 @@ func (c *ctxt5) addpool(p *obj.Prog, a *obj.Addr) {
                        t.Rel = p
                }
 
-       case C_SROREG,
-               C_LOREG,
-               C_ROREG,
+       case C_HOREG,
                C_FOREG,
+               C_HFOREG,
                C_SOREG,
-               C_HOREG,
+               C_ROREG,
+               C_SROREG,
+               C_LOREG,
+               C_HAUTO,
                C_FAUTO,
+               C_HFAUTO,
                C_SAUTO,
                C_LAUTO,
                C_LACON:
diff --git a/test/fixedbugs/issue57955.go b/test/fixedbugs/issue57955.go
new file mode 100644 (file)
index 0000000..bee28c6
--- /dev/null
@@ -0,0 +1,43 @@
+// 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("")
+       }
+}