uap-go icon indicating copy to clipboard operation
uap-go copied to clipboard

32 Bit systems

Open 0x4139 opened this issue 7 years ago • 2 comments

Go does not provide automatic alignment for the 32 bit system In sync/atomic/asm_386.s we see that the 64 bit operations have the following preamble:

MOVL    addr+0(FP), BP
TESTL   $7, BP
JZ      2(PC)
MOVL    0, AX // crash with nil ptr deref

so that means that it will crash on arm/32 bit systems your code due to the fact it uses

atomic.LoadUint64

we can use a lock or manual alignment if you insist on using the LoadUint64

0x4139 avatar Jan 31 '17 15:01 0x4139

+1 From the bottom of the sync/atomic docs (the "Bugs" section):

On both ARM and x86-32, it is the caller's responsibility to arrange for 64-bit alignment of 64-bit words accessed atomically.

patch here:

https://github.com/realPy/uap-go/commit/489eff70e21e9cfaa92002a57fa1fcc48fce540e

realPy avatar Aug 22 '19 08:08 realPy

this issue can be closed

realPy avatar Sep 02 '19 11:09 realPy