You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When GOARCH is set to mipsle, sync/atomic.Loadint64 will prompt "invalid memory address or nil pointer dereference" when sync.WaitGroup exists in the structure
#41970
package main
import (
"fmt"
"sync"
"sync/atomic"
)
type TestStruct struct {
wgClose sync.WaitGroup // When it exists, it will report an error, comment out it is normal
requestTimeout int64
}
func main() {
testV := TestStruct{}
fmt.Println(atomic.LoadInt64(&testV.requestTimeout))
}
What did you expect to see?
0
What did you see instead?
panic: runtime error: invalid memory address or nil pointer dereference
The text was updated successfully, but these errors were encountered:
On ARM, x86-32, and 32-bit MIPS, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically. The first word in a variable or in an allocated struct, array, or slice can be relied upon to be 64-bit aligned.
We are working to fix this (#36606) but for now the solution is to put atomically accessed 64-bit fields at the start of the struct to guarantee 64-bit alignment.
What version of Go are you using (
go version
)?yum package(Repository: epel):
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Build(x86):
Run(mips):
Source:
What did you expect to see?
What did you see instead?
The text was updated successfully, but these errors were encountered: