Re: [go-nuts] Re: Local variable escapes to heap

2020-11-21 Thread jake...@gmail.com
For me, the example you gave of sorty is a strong argument against adding go:local. If I understand correctly, using go:local, if a variable marked this way actually does escape it would cause undefined behavior, possibly in unrelated code. This is the type of bug that is very, very hard to

Re: [go-nuts] Online service to run Go code with Go modules support

2020-11-21 Thread Alexey Melezhik
And what about system libraries. Tools like make or gcc required to compile some go modules, f.e. sqlite bindings? For example for gorm I get this error, due to absense of gcc compiler: github.com/mattn/go-sqlite3 exec: "gcc": executable file not found in $PATH

Re: [go-nuts] Re: Local variable escapes to heap

2020-11-21 Thread jfcg...@gmail.com
In sorty (commit e4fb296daf1d90037d) I see: $ go build -gcflags -m |& grep -i heap ./sortyI8.go:319:2: moved to heap: sv ./sortyU8.go:319:2: moved to heap: sv ./sortyF4.go:319:2: moved to heap: sv ./sortyF8.go:319:2: moved to heap: sv ./sortyI4.go:319:2: moved to

Re: [go-nuts] Re: Local variable escapes to heap

2020-11-21 Thread Ian Lance Taylor
On Sat, Nov 21, 2020 at 12:11 AM jfcg...@gmail.com wrote: > > I have the following: > > package myf > > func F1(x *int, ch chan bool) { > *x += 1 > ch <- false > } > > func F2() { > var x int > ch := make(chan bool) // or with buffer > go F1(, ch) > <-ch > } > > I get this

Re: [go-nuts] Carting int to bool and the reverse for bit hacking ?

2020-11-21 Thread Aleksey Tulinov
To me your example appears somewhat confusing, int(bool(int())) is the fishiest part IMO. I assume bool(int()) is just (v^v1 != 0) in disguise and this is essentially (v^v1 != 0) & (v^v2 != 0) & (v^v3 != 0) Am i right? Go can't & bools, so func bool2int(b bool) int { // This is what Go

[go-nuts] Re: Carting int to bool and the reverse for bit hacking ?

2020-11-21 Thread christoph...@gmail.com
Thank you for the responses. Unfortunately, they all comment on the given use case. The real question is if we should add a function in math/bits that performs the operation. The function would be func notZero(x int) int { if x == 0 { return 0 } return 1 } Regarding code

Re: [go-nuts] Estimating blockers for supporting gollvm on RISC-V (qemu). Fedora 33

2020-11-21 Thread Ivan Serdyuk
Wei, Carlos: adding you to this discussion. Carlos, please ask your questions. What was not understood, regarding my attempt? Hence that QEMU's host OS could be, say, Fedora 32+ x86_64. Ivan On Sat, Nov 21, 2020 at 5:36 AM Ivan Serdyuk wrote: > Hello. > > It is just a brief survey - but I am

[go-nuts] Re: Carting int to bool and the reverse for bit hacking ?

2020-11-21 Thread b.ca...@pobox.com
That's fantastic. Paste in int Test0(int v, int v1, int v2, int v3) { return v == v1 || v == v2 || v == v3; } and then the the compiler options to -O3. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Local variable escapes to heap

2020-11-21 Thread jfcg...@gmail.com
Hi, I have the following: package myf func F1(x *int, ch chan bool) { *x += 1 ch <- false } func F2() { var x int ch := make(chan bool) // or with buffer go F1(, ch) <-ch } I get this when I build with go 1.15.5 via go build -gcflags '-m -m' : 3:6: can inline F1 with