On Mon, Mar 21, 2022 at 6:58 PM Jagan Sivakumar <jagansu...@gmail.com> wrote:
>
> 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]

Thanks.  I don't know why this would happen.  If this happens
repeatedly then please open a bug report with all the details at
https://go.dev/issue/new.

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/CAOyqgcV-kERtF9FTsQvCB8D5DKSJ9RKrOizf6wHWbo_ZuwNimQ%40mail.gmail.com.

Reply via email to