]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/escape: escape values with >PtrSize alignment
authorMichael Anthony Knyszek <mknyszek@google.com>
Fri, 3 Jun 2022 19:15:24 +0000 (19:15 +0000)
committerMichael Knyszek <mknyszek@google.com>
Fri, 3 Jun 2022 20:15:20 +0000 (20:15 +0000)
commit162b88265ed41e61d6af20f7ad2039ddcdf51a2c
tree27de8b8c29449e10ca98be88c0ee6b654ed1c9d9
parentee87cd1dd95fe46099e393143d9a6dcccf0a6db0
cmd/compile/internal/escape: escape values with >PtrSize alignment

After CL 381317 there exist values that may have an alignment greater
than the pointer size for that platform. Specifically, atomic.{Ui|I}nt64
may be aligned to 8 bytes on a 32-bit platform. If such a value, or
a container for the value, gets stack-allocated, it's possible that it
won't be aligned correctly, because the maximum alignment we enforce on
stacks is governed by the pointer size. Changing that would be a
significant undertaking, so just escape these values to the heap
instead, where we're sure they'll actually be aligned correctly.

Change is by rsc@, I'm just shepherding it through code review.

For #50860.

Change-Id: I51669561c0a13ecb84f821020e144c58cb528418
Reviewed-on: https://go-review.googlesource.com/c/go/+/410131
Run-TryBot: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/cmd/compile/internal/escape/utils.go