Commit c7505270f4 for golang
commit c7505270f4c4854768e6801447cfca44d460ae50
Author: Srinivas Pokala <Pokala.Srinivas@ibm.com>
Date: Wed Dec 2 17:46:26 2026 +0100
test: add regression test for s390x "width not calculated" ICE
On s390x, converting a constant int8 to an interface and asserting it
back to a type parameter wider than one byte in a generic function
crashed the compiler with:
"internal compiler error: width not calculated: [2048]uint8"
walk.dataWord addresses runtime.staticuint64s through a synthesized
[256*8]uint8 type that was never sized. Once type sizing is disabled
in the parallel backend, the s390x rules that merge SB offsets into
loads ask for that type's alignment, which hits the unsized array.
This was fixed on master incidentally by CL 802320 (generalize
staticuint64s sharing to larger integer constant types), which added
a types.CalcSize call, but that CL did not add a test for the crash.
Add one, so the bug stays fixed and the test can be used to validate
backports to the release branches.
The test fails at 591ed42daf (the parent of CL 802320) when
targeting linux/s390x, and passes at tip.
Updates #83436
Change-Id: I880e2506eaa3240294c55f441cc12156a0ef8a7d
Reviewed-on: https://go-review.googlesource.com/c/go/+/869281
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: PJ Malloy <pjmalloy@google.com>
Reviewed-by: t hepudds <thepudds1460@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
diff --git a/test/fixedbugs/issue83436.go b/test/fixedbugs/issue83436.go
new file mode 100644
index 0000000000..536709a642
--- /dev/null
+++ b/test/fixedbugs/issue83436.go
@@ -0,0 +1,40 @@
+// compile
+
+// Copyright 2026 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.
+
+package p
+
+type Integers interface{ ~int8 | ~uint32 }
+
+func f[T Integers](v T, c bool) T {
+ if c {
+ return any(int8(-1)).(T)
+ }
+ return v
+}
+func g[T Integers](x any, v T) T {
+ switch x.(type) {
+ case int8:
+ return any(int8(-1)).(T)
+ }
+ return v
+}
+func h[T Integers](v T, c bool) T {
+ var x any = v
+ if c {
+ x = int8(5)
+ }
+ switch x.(type) {
+ case int8:
+ return any(int8(-1)).(T)
+ }
+ return v
+}
+
+var (
+ _ = f[uint32]
+ _ = g[uint32]
+ _ = h[uint32]
+)