uap-go
uap-go copied to clipboard
32 Bit systems
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
+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
this issue can be closed