On Fri, Jul 8, 2022 at 9:19 AM Richiise Nugraha <richii...@gmail.com> wrote:
>
> Hi, i was testing this code on Go playground and it works just fine, however 
> if i run with `-race` it throws `pointer arithmetic result points to invalid 
> allocation` although it has the same address. What really causes this?, like 
> the address (untouched) still a valid allocation
>
> ptr = 0xc000138008
> p = 0xc000138008
> base = 0xc000138000
> originals = []unsafe.Pointer len: 0, cap: 0, nil
>
> https://go.dev/play/p/RcvaWHJ8dMB
> (or https://gist.github.com/ii64/d9753a03f0fad8172729e044943a35e5)

Your code is breaking the unsafe.Pointer rules documented at
https://pkg.go.dev/unsafe#Pointer.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAOyqgcWLpmm4kCNy3FZgNmFTJgc1MbunPh0C%2Br1KBxYSXrhpDA%40mail.gmail.com.

Reply via email to