On Wed, 2024-02-14 at 02:07 -0800, Poonai wrote: > Thanks all, > > figured out the issue: > > func main() { > a := big.NewInt(1) > b := *a > c := *a > c.Sub(&c, big.NewInt(1)) > fmt.Println(b.String()) > fmt.Println(c.String()) > fmt.Println(a.String()) > } > > > reproducible code. don't know what causing it tho :(
Minimised: https://go.dev/play/p/oL17vkcjaEl This is happening because the sum in a doesn't result in a normalisation of b, https://go.dev/play/p/cIBDbRXFnAT (in this situation where the abs field represents a zero, it should be zero length). Given that this can happen without a race or unsafe modifications it might be worth filing a issue for. -- 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/6823242c8654f406db5dfc2bb04d1ca0efa51139.camel%40kortschak.io.