Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x804907c] #185

Closed
ddulesov opened this issue Apr 12, 2017 · 4 comments
Closed

Comments

@ddulesov
Copy link

on linux x86-32 platform get panic

sync/atomic.LoadUint64(0x1888b77c, 0x1, 0x101)
        /tmp/go/src/sync/atomic/asm_386.s:159 +0xb
gopkg.in/rana/ora%2ev4.(*Rset).Len(0x1888b720, 0x83773a8)
        /go/src/gopkg.in/rana/ora.v4/rset.go:122 +0x26

Rset.index field is not alignment on 64-bit boundary on x86
this issue explained https://golang.org/pkg/sync/atomic/#pkg-note-BUG

to reproduce bug

package main
import (
        "fmt"
        "sync/atomic"
)
type R struct {
        b       byte
        index  int64
}
func (r *R) bugtest(){
        atomic.AddInt64(&r.index, 1)
}
func main(){
        r := &R{index: -1}
        atomic.AddInt64(&r.index, 1)
        fmt.Printf("result %d", r.index)

        r.bugtest()
        fmt.Printf("result %d", r.index)
}
@tgulacsi
Copy link
Collaborator

tgulacsi commented Apr 12, 2017 via email

@ddulesov
Copy link
Author

ddulesov commented Apr 13, 2017 via email

@tgulacsi
Copy link
Collaborator

tgulacsi commented Apr 13, 2017 via email

@ddulesov
Copy link
Author

ddulesov commented Apr 13, 2017 via email

tgulacsi added a commit that referenced this issue Apr 13, 2017
To be able to use atomic....Int32, to alleviate the alignedness restrictions
on 32bit platforms.

Fixes #185
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants