[ https://issues.apache.org/jira/browse/ARROW-7029?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16962903#comment-16962903 ]
Sebastien Binet edited comment on ARROW-7029 at 10/31/19 2:01 PM: ------------------------------------------------------------------ [~stuartcarnie] it seems we'd need to modify this kind of code: {code} func memory_memset_avx2(buf []byte, c byte) { if len(buf) == 0 { return } var ( p1 = unsafe.Pointer(&buf[0]) p2 = unsafe.Pointer(uintptr(len(buf))) // !!! line 33 !!! p3 = unsafe.Pointer(uintptr(c)) ) if len(buf) > 2000 || isMultipleOfPowerOf2(len(buf), 256) { _memset_avx2(p1, p2, p3) } else { _memset_sse4(p1, p2, p3) } } {code} (and the according assembly) was (Author: sbinet): [~stuartcarnie] it seems we'd need to modify this kind of code: ~~~ func memory_memset_avx2(buf []byte, c byte) { if len(buf) == 0 { return } var ( p1 = unsafe.Pointer(&buf[0]) p2 = unsafe.Pointer(uintptr(len(buf))) // !!! line 33 !!! p3 = unsafe.Pointer(uintptr(c)) ) if len(buf) > 2000 || isMultipleOfPowerOf2(len(buf), 256) { _memset_avx2(p1, p2, p3) } else { _memset_sse4(p1, p2, p3) } } ~~~ (and the according assembly) > [Go] unsafe pointer arithmetic panic w/ Go-1.14-dev > --------------------------------------------------- > > Key: ARROW-7029 > URL: https://issues.apache.org/jira/browse/ARROW-7029 > Project: Apache Arrow > Issue Type: Bug > Components: Go > Reporter: Sebastien Binet > Priority: Major > > Go-1.14 (to be released in Feb-2020) has a new analysis pass (enabled with > -race) that checks for unsafe pointer arithmetic: > {code} > $> go test -race -run=Example_minimal . > --- FAIL: Example_minimal (0.00s) > panic: runtime error: unsafe pointer arithmetic [recovered] > panic: runtime error: unsafe pointer arithmetic > goroutine 1 [running]: > testing.(*InternalExample).processRunResult(0xc0000adc80, 0x0, 0x0, 0x8927, > 0x90a400, 0xc0000b62c0, 0xc0000a48c8) > /home/binet/sdk/go/src/testing/example.go:89 +0x71f > testing.runExample.func2(0xbf6675c29511646d, 0x20fb5f, 0xc7f780, > 0xc0000a2378, 0xc0000a2008, 0xc000086360, 0xc0000adc80, 0xc0000adcb0) > /home/binet/sdk/go/src/testing/run_example.go:58 +0x143 > panic(0x90a400, 0xc0000b62c0) > /home/binet/sdk/go/src/runtime/panic.go:915 +0x370 > github.com/apache/arrow/go/arrow/memory.memory_memset_avx2(0xc00009e200, > 0x40, 0x40, 0xc9c000) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/memory/memory_avx2_amd64.go:33 > +0xa4 > github.com/apache/arrow/go/arrow/memory.Set(...) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/memory/memory.go:25 > github.com/apache/arrow/go/arrow/array.(*builder).init(0xc000084600, 0x20) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/builder.go:101 > +0x23a > github.com/apache/arrow/go/arrow/array.(*Int64Builder).init(0xc000084600, > 0x20) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/numericbuilder.gen.go:102 > +0x60 > github.com/apache/arrow/go/arrow/array.(*Int64Builder).Resize(0xc000084600, > 0x2) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/numericbuilder.gen.go:125 > +0x8c > github.com/apache/arrow/go/arrow/array.(*builder).reserve(0xc000084600, 0x1, > 0xc0000ad918) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/builder.go:138 > +0xdc > github.com/apache/arrow/go/arrow/array.(*Int64Builder).Reserve(0xc000084600, > 0x1) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/numericbuilder.gen.go:113 > +0x68 > github.com/apache/arrow/go/arrow/array.(*Int64Builder).Append(0xc000084600, > 0x1) > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/array/numericbuilder.gen.go:60 > +0x46 > github.com/apache/arrow/go/arrow_test.Example_minimal() > > /home/binet/work/gonum/src/github.com/apache/arrow/go/arrow/example_test.go:39 > +0x153 > testing.runExample(0x94714a, 0xf, 0x95d8a8, 0x957614, 0x83, 0x0, 0x0) > /home/binet/sdk/go/src/testing/run_example.go:62 +0x275 > testing.runExamples(0xc0000aded8, 0xc7a2e0, 0xb, 0xb, 0x100) > /home/binet/sdk/go/src/testing/example.go:44 +0x212 > testing.(*M).Run(0xc000100000, 0x0) > /home/binet/sdk/go/src/testing/testing.go:1125 +0x3b4 > main.main() > _testmain.go:130 +0x224 > FAIL github.com/apache/arrow/go/arrow 0.009s > FAIL > {code} > > see: > [https://groups.google.com/forum/#!msg/golang-dev/SzwDoqoRVJA/IvtnBW5oDwAJ] > -- This message was sent by Atlassian Jira (v8.3.4#803005)