src/cmd/compile/internal/types/type.go | 3 +++ test/fixedbugs/issue65957.dir/a.go | 12 ++++++++++++ test/fixedbugs/issue65957.dir/main.go | 19 +++++++++++++++++++ test/fixedbugs/issue65957.go | 7 +++++++ diff --git a/src/cmd/compile/internal/types/type.go b/src/cmd/compile/internal/types/type.go index 2777b4f007318b2104034aed0954d6228a0ddb23..c2b0ca3a4458c274754f211e7e61ea7b39775983 100644 --- a/src/cmd/compile/internal/types/type.go +++ b/src/cmd/compile/internal/types/type.go @@ -657,6 +657,9 @@ } if elem.HasShape() { t.SetHasShape(true) } + if elem.Noalg() { + t.SetNoalg(true) + } return t } diff --git a/test/fixedbugs/issue65957.dir/a.go b/test/fixedbugs/issue65957.dir/a.go new file mode 100644 index 0000000000000000000000000000000000000000..284ec4af9f2df586e16291ff57b1124c4360e3fb --- /dev/null +++ b/test/fixedbugs/issue65957.dir/a.go @@ -0,0 +1,12 @@ +// Copyright 2024 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 a + +var s any + +//go:noinline +func F() { + s = new([4]int32) +} diff --git a/test/fixedbugs/issue65957.dir/main.go b/test/fixedbugs/issue65957.dir/main.go new file mode 100644 index 0000000000000000000000000000000000000000..89b8a28234513120c7a6c8a135e16fe436306711 --- /dev/null +++ b/test/fixedbugs/issue65957.dir/main.go @@ -0,0 +1,19 @@ +// Copyright 2024 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 main + +import ( + "./a" + "reflect" +) + +var s = []rune{0, 1, 2, 3} + +func main() { + m := map[any]int{} + k := reflect.New(reflect.ArrayOf(4, reflect.TypeOf(int32(0)))).Elem().Interface() + m[k] = 1 + a.F() +} diff --git a/test/fixedbugs/issue65957.go b/test/fixedbugs/issue65957.go new file mode 100644 index 0000000000000000000000000000000000000000..48e4d34c9321298ea5007559d7008a0ec1071adf --- /dev/null +++ b/test/fixedbugs/issue65957.go @@ -0,0 +1,7 @@ +// rundir + +// Copyright 2024 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 ignored