On Tue, May 19, 2020 at 6:35 AM CHIGOT, CLEMENT <clement.chi...@atos.net> wrote: > > Description: > On aix/ppc64, it's possible to allocate an array of 1<<50 int, because of > the > wider address space. Thus, increase it to 1<<59 like in Golang toolchain in > order to trigger the panic. > > Changelog: > 2020-05-19 Clement Chigot <clement.chi...@atos.net> > * go.test/test/fixedbugs/issue4085b.go: increase the size of n2 in 64bit > > > Please apply for me if approved. > Could it be backported in gcc-8 and gcc-9 branch too ?
Thanks. I've updated this file to the version that is in the Go 1.13 release, as appended. Committed to master, GCC 10 branch, and GCC 9 branch. Not committed to GCC 8 branch as the file is different there. Ian
diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue4085b.go b/gcc/testsuite/go.test/test/fixedbugs/issue4085b.go index 6bf315fcc2f..6304ce073aa 100644 --- a/gcc/testsuite/go.test/test/fixedbugs/issue4085b.go +++ b/gcc/testsuite/go.test/test/fixedbugs/issue4085b.go @@ -21,9 +21,11 @@ func main() { shouldPanic("cap out of range", func() { _ = make(T, 0, int64(n)) }) var t *byte if unsafe.Sizeof(t) == 8 { - var n2 int64 = 1 << 50 + // Test mem > maxAlloc + var n2 int64 = 1 << 59 shouldPanic("len out of range", func() { _ = make(T, int(n2)) }) shouldPanic("cap out of range", func() { _ = make(T, 0, int(n2)) }) + // Test elem.size*cap overflow n2 = 1<<63 - 1 shouldPanic("len out of range", func() { _ = make(T, int(n2)) }) shouldPanic("cap out of range", func() { _ = make(T, 0, int(n2)) })