-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
package main
import (
"math"
"sync/atomic"
)
type small struct {
small [64]byte
}
type big struct {
big [math.MaxUint16 * 10]byte
}
func main() {
a := atomic.Pointer[small]{}
a.Store(&small{})
b := atomic.Pointer[big](a) // type conversion
big := b.Load()
for i := range big.big {
big.big[i] = 1
}
}
This sample (on my system) produces a segfault:
[mateusz@arch aa ]$ go run main.go
signal: segmentation fault (core dumped)
So we basically done a unsafe type conversion without using the unsafe package.
zigo101 and bunnier
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.