HI Ian Thanks for your quick response. Send the mail in plain text mode. Trying to run a sample GO program cross compiled to RISCV platform. Getting segmentation violation issues when performing read and write in a large array list. Kindly let me know how to address the issue
Sample GO Program: package main import ( "fmt" "math/rand" ) func main() { fmt.Println("Enter array size: ") var arraySize int fmt.Scanln(&arraySize) list := make([]float64, arraySize) for i := 0; i < arraySize; i++ { list[i] = rand.Float64() } for i := 0; i < arraySize; i++ { if( i % 100000 == 0){ fmt.Print("Index[") fmt.Print(i) fmt.Print("] =") fmt.Println(list[i]) } } } Compile Command : GOOS=linux GOARCH=riscv64 go build -o bin/go-array go-array.go Error: Getting segmentation violation issue when performing read and write in large array list. Logs: /go-test # env GOGC=50 GODEBUG=gctrace=1 GOTRACEBACK=crash ./go-array-riscv Enter array size: 10000000 gc 1 @1458.220s 0%: 29+14830+12 ms clock, 29+0/3705/0+12 ms cpu, 76->76->76 MB, 76 MB goal, 0 MB stacks, 0 MB globals, 1 P GC forced gc 2 @1593.150s 0%: 27+5800+7.8 ms clock, 27+0/1449/0+7.8 ms cpu, 76->76->76 MB, 114 MB goal, 0 MB stacks, 0 MB globals, 1 P GC forced gc 3 @1719.021s 0%: 33+5560+7.3 ms clock, 33+0/1406/0+7.3 ms cpu, 76->76->76 MB, 114 MB goal, 0 MB stacks, 0 MB globals, 1 P GC forced fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x0] runtime stack: runtime.throw({0xbe0e4, 0x2a}) /usr/local/go/src/runtime/panic.go:992 +0x58 fp=0x3fc403ff60 sp=0x3fc403ff38 pc=0x41420 runtime: unexpected return pc for runtime.sigpanic called from 0x1 stack: frame={sp:0x3fc403ff60, fp:0x3fc403ff90} stack=[0x3fc403e000,0x3fc4040000) 0x0000003fc403fe60: 0x0000000000000000 0x0000000000041698 <runtime.fatalthrow.func1+0x0000000000000050> 0x0000003fc403fe70: 0x0000000000041420 <runtime.throw+0x0000000000000058> 0x0000003fc403ff38 0x0000003fc403fe80: 0x0000000000000000 0x0000003fc4002820 0x0000003fc403fe90: 0x01000000000419d8 0x000000000000000b 0x0000003fc403fea0: 0x000000000000001f 0x0000000000000000 0x0000003fc403feb0: 0x0000000000000000 0x0000000000000001 0x0000003fc403fec0: 0x00000000000bc31e 0x0000000000041630 <runtime.fatalthrow+0x0000000000000048> 0x0000003fc403fed0: 0x0000003fc4002820 0x0000000000041420 <runtime.throw+0x0000000000000058> 0x0000003fc403fee0: 0x0000003fc403ff38 0x0000000000042e40 <runtime.printunlock+0x0000000000000050> 0x0000003fc403fef0: 0x0000003fc403ff38 0x0000000000041420 <runtime.throw+0x0000000000000058> 0x0000003fc403ff00: 0x0000003fc4002820 0x0000000000041420 <runtime.throw+0x0000000000000058> 0x0000003fc403ff10: 0x0000003fc403ff18 0x0000000000041648 <runtime.fatalthrow.func1+0x0000000000000000> 0x0000003fc403ff20: 0x0000003fc4002820 0x0000000000041420 <runtime.throw+0x0000000000000058> 0x0000003fc403ff30: 0x0000003fc403ff38 0x00000000000567e0 <runtime.sigpanic+0x0000000000000230> 0x0000003fc403ff40: 0x0000003fc403ff48 0x0000000000041448 <runtime.throw.func1+0x0000000000000000> 0x0000003fc403ff50: 0x00000000000be0e4 0x000000000000002a 0x0000003fc403ff60: <0x0000000000000001 0x00000000000be0e4 0x0000003fc403ff70: 0x000000000000002a 0x0000003fc942ec60 0x0000003fc403ff80: 0x000000000015a518 0x0000000000028824 <runtime.gcResetMarkState+0x000000000000006c> 0x0000003fc403ff90: >0x0000000000000001 0x0000000000025a5c <runtime.gcStart.func1+0x000000000000001c> 0x0000003fc403ffa0: 0x00000000001801c8 0x0000003fc91f4400 0x0000003fc403ffb0: 0x0000000600000001 0x0000000000000004 0x0000003fc403ffc0: 0x0000000000000000 0x00000000001801c0 0x0000003fc403ffd0: 0x000000000006a818 <runtime.systemstack+0x0000000000000050> 0x000000000006a78c <runtime.mstart+0x000000000000000c> 0x0000003fc403ffe0: 0x00000000000004d2 0x000000000006a780 <runtime.mstart+0x0000000000000000> 0x0000003fc403fff0: 0xffffffc03bfc2000 0x000000000006dd58 <runtime.clone+0x0000000000000078> runtime.sigpanic() /usr/local/go/src/runtime/signal_unix.go:802 +0x230 fp=0x3fc403ff90 sp=0x3fc403ff60 pc=0x567e0 goroutine 2 [running]: runtime.systemstack_switch() /usr/local/go/src/runtime/asm_riscv64.s:96 +0x8 fp=0x3fc402af38 sp=0x3fc402af30 pc=0x6a7b0 runtime.gcStart({0x1, 0x29b5fbb7404, 0x0}) /usr/local/go/src/runtime/mgc.go:663 +0x500 fp=0x3fc402afb0 sp=0x3fc402af38 pc=0x25f78 runtime.forcegchelper() /usr/local/go/src/runtime/proc.go:307 +0x64 fp=0x3fc402afd8 sp=0x3fc402afb0 pc=0x43e44 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc402afd8 sp=0x3fc402afd8 pc=0x6c5dc created by runtime.init.5 /usr/local/go/src/runtime/proc.go:289 +0x28 goroutine 1 [runnable]: math/rand.Float64() /usr/local/go/src/math/rand/rand.go:341 +0xc fp=0x3fc4056ea8 sp=0x3fc4056ea8 pc=0x9df84 main.main() /go-test/go-array.go:14 +0x138 fp=0x3fc4056f80 sp=0x3fc4056ea8 pc=0x9e708 runtime.main() /usr/local/go/src/runtime/proc.go:250 +0x228 fp=0x3fc4056fd8 sp=0x3fc4056f80 pc=0x43bc8 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc4056fd8 sp=0x3fc4056fd8 pc=0x6c5dc goroutine 3 [GC sweep wait]: runtime.gopark(0xbfbf0, 0x159d80, 0xc, 0x14, 0x1) /usr/local/go/src/runtime/proc.go:361 +0xfc fp=0x3fc402b7a0 sp=0x3fc402b788 pc=0x4401c runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:367 runtime.bgsweep(0x3fc4048000) /usr/local/go/src/runtime/mgcsweep.go:297 +0x138 fp=0x3fc402b7c8 sp=0x3fc402b7a0 pc=0x30758 runtime.gcenable.func1() /usr/local/go/src/runtime/mgc.go:177 +0x2c fp=0x3fc402b7d8 sp=0x3fc402b7c8 pc=0x25954 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc402b7d8 sp=0x3fc402b7d8 pc=0x6c5dc created by runtime.gcenable /usr/local/go/src/runtime/mgc.go:177 +0x90 goroutine 4 [GC scavenge wait]: runtime.gopark(0xbfbf0, 0x159d40, 0xd, 0x14, 0x1) /usr/local/go/src/runtime/proc.go:361 +0xfc fp=0x3fc402bef8 sp=0x3fc402bee0 pc=0x4401c runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:367 runtime.bgscavenge(0x3fc4048000) /usr/local/go/src/runtime/mgcscavenge.go:364 +0x32c fp=0x3fc402bfc8 sp=0x3fc402bef8 pc=0x2e39c runtime.gcenable.func2() /usr/local/go/src/runtime/mgc.go:178 +0x2c fp=0x3fc402bfd8 sp=0x3fc402bfc8 pc=0x258f4 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc402bfd8 sp=0x3fc402bfd8 pc=0x6c5dc created by runtime.gcenable /usr/local/go/src/runtime/mgc.go:178 +0xe8 goroutine 5 [finalizer wait, 6 minutes]: runtime.gopark(0xbfbf0, 0x186788, 0x10, 0x14, 0x1) /usr/local/go/src/runtime/proc.go:361 +0xfc fp=0x3fc402a738 sp=0x3fc402a720 pc=0x4401c runtime.goparkunlock(...) /usr/local/go/src/runtime/proc.go:367 runtime.runfinq() /usr/local/go/src/runtime/mfinal.go:177 +0xd0 fp=0x3fc402a7d8 sp=0x3fc402a738 pc=0x24960 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc402a7d8 sp=0x3fc402a7d8 pc=0x6c5dc created by runtime.createfing /usr/local/go/src/runtime/mfinal.go:157 +0x60 goroutine 6 [GC worker (idle)]: runtime.gopark(0xbfad8, 0x3fc4070000, 0x18, 0x14, 0x0) /usr/local/go/src/runtime/proc.go:361 +0xfc fp=0x3fc402c758 sp=0x3fc402c740 pc=0x4401c runtime.gcBgMarkWorker() /usr/local/go/src/runtime/mgc.go:1207 +0x114 fp=0x3fc402c7d8 sp=0x3fc402c758 pc=0x27a54 runtime.goexit() /usr/local/go/src/runtime/asm_riscv64.s:497 +0x4 fp=0x3fc402c7d8 sp=0x3fc402c7d8 pc=0x6c5dc created by runtime.gcBgMarkStartWorkers /usr/local/go/src/runtime/mgc.go:1131 +0x2c Aborted On Mon, Mar 21, 2022 at 7:46 PM Ian Lance Taylor <i...@golang.org> wrote: > > On Sun, Mar 20, 2022 at 9:12 AM Jagan Sivakumar <jagansu...@gmail.com> wrote: >> >> HI Team >> Trying to run a sample GO program cross compiled to RISCV platform. >> Getting segmentation violation issue when performing read and write in large >> array list. >> Kindly let me know how to address the issue >> >> Sample GO Program: >> package main >> >> import ( >> "fmt" >> "math/rand" >> ) >> func main() { >> >> fmt.Println("Enter array size: ") >> var arraySize int >> fmt.Scanln(&arraySize) >> list := make([]float64, arraySize) >> for i := 0; i < arraySize; i++ { >> list[i] = rand.Float64() >> } >> for i := 0; i < arraySize; i++ { >> if( i % 100000 == 0){ >> fmt.Print("Index[") >> fmt.Print(i) >> fmt.Print("] =") >> fmt.Println(list[i]) >> } >> } >> } >> >> Compile Command : >> GOOS=linux GOARCH=riscv64 go build -o bin/go-array go-array.go >> >> >> Error: >> >> > > > Sorry, but please send plain text as plain text, not as images. I can't read > your images. > > Ian -- Regards Jagan Sivakumar -- 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/CAPF60xV0%3D%3DxtHvM67eKQNLsH8b_49%2BU4b_SmqRnB8SySK6uo4Q%40mail.gmail.com.