[Bug target/107590] __atomic_test_and_set broken on PowerPC

vital.had at gmail dot com gcc-bugzilla@gcc.gnu.org
Thu Nov 10 18:24:16 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107590

--- Comment #12 from Sergey Fedorov <vital.had at gmail dot com> ---
(In reply to Andrew Pinski from comment #2)
> >Reason: 259 at address: 0x00003109
> 
> Yes that does seem like an alignment disagreement.
> 
> I suspect the code is broken for allocation and it is allocating unaligned
> structs.
> 
> Also inside gdb can you do the following:
> 
> disassemble $pc-0x10 $pc+0x10
> info registers

Here:

(gdb) run
Starting program: /Users/svacchanda/Dev/boost/a.out 
Reading symbols for shared libraries ++++.. done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 259 at address: 0x0000208d
0x00001b38 in boost::detail::spinlock::try_lock (this=0x208d) at
spinlock_gcc_atomic.hpp:39
39              return __atomic_test_and_set( &v_, __ATOMIC_ACQUIRE ) == 0;
(gdb) disassemble $pc-0x10 $pc+0x10
Dump of assembler code from 0x1b28 to 0x1b48:
0x00001b28 <_ZN5boost6detail8spinlock8try_lockEv+8>:    mr      r30,r1
0x00001b2c <_ZN5boost6detail8spinlock8try_lockEv+12>:   stw     r3,72(r30)
0x00001b30 <_ZN5boost6detail8spinlock8try_lockEv+16>:   lwz     r2,72(r30)
0x00001b34 <_ZN5boost6detail8spinlock8try_lockEv+20>:   li      r9,1
0x00001b38 <_ZN5boost6detail8spinlock8try_lockEv+24>:   lwarx   r10,0,r2
0x00001b3c <_ZN5boost6detail8spinlock8try_lockEv+28>:   stwcx.  r9,0,r2
0x00001b40 <_ZN5boost6detail8spinlock8try_lockEv+32>:   bne-    0x1b38
<_ZN5boost6detail8spinlock8try_lockEv+24>
0x00001b44 <_ZN5boost6detail8spinlock8try_lockEv+36>:   isync
End of assembler dump.
(gdb) info registers
r0             0x19c4   6596
r1             0xbffff9f0       3221223920
r2             0x208d   8333
r3             0x208d   8333
r4             0xbffffb30       3221224240
r5             0xbffffb38       3221224248
r6             0xbffffb88       3221224328
r7             0xc      12
r8             0x0      0
r9             0x1      1
r10            0x0      0
r11            0x2048   8264
r12            0x1b20   6944
r13            0x0      0
r14            0x0      0
r15            0x0      0
r16            0x0      0
r17            0x0      0
r18            0x0      0
r19            0x0      0
r20            0x0      0
r21            0x0      0
r22            0x0      0
r23            0x0      0
r24            0x0      0
r25            0x0      0
r26            0xbffffb2c       3221224236
r27            0x8      8
r28            0x0      0
r29            0x0      0
r30            0xbffff9f0       3221223920
r31            0x19a8   6568
pc             0x1b38   6968
ps             0x100000000000f030       1152921504606908464
cr             0x24000002       603979778
lr             0x1ba4   7076
ctr            0x1b20   6944
xer            0x0      0
mq             0x0      0
fpscr          0x0      0
vscr           0x10000  65536
vrsave         0x0      0


More information about the Gcc-bugs mailing list