Comment 7 for bug 491872

Revision history for this message
Dave Martin (dave-martin-arm) wrote :

Unfortunately, the __sync_synchronize() bug appears still to be present in the updated GCC.
A call to this intrinsic still disappears in the compiler's output.

The __sync_lock_test_and_set() bug may still be present; however it is also possible that the __sync_synchronize() bug is masking the fix.

$ apt-cache policy gcc-4.4 cpp-4.4
gcc-4.4:
  Installed: 4.4.2-3ubuntu2
  Candidate: 4.4.2-3ubuntu2
  Version table:
 *** 4.4.2-3ubuntu2 0
        500 http://arm-ports-ubuntu lucid/main Packages
        100 /var/lib/dpkg/status
cpp-4.4:
  Installed: 4.4.2-3ubuntu2
  Candidate: 4.4.2-3ubuntu2
  Version table:
 *** 4.4.2-3ubuntu2 0
        500 http://arm-ports-ubuntu lucid/main Packages
        100 /var/lib/dpkg/status

$ echo 'void f(void) { __sync_synchronize(); }' | gcc -S -o- -xc -
 .syntax unified
 .arch armv7-a
 .eabi_attribute 27, 3
 .fpu vfpv3-d16
 .eabi_attribute 20, 1
 .eabi_attribute 21, 1
 .eabi_attribute 23, 3
 .eabi_attribute 24, 1
 .eabi_attribute 25, 1
 .eabi_attribute 26, 2
 .eabi_attribute 30, 6
 .eabi_attribute 18, 4
 .thumb
 .file ""
 .text
 .align 2
 .global f
 .thumb
 .thumb_func
 .type f, %function
f:
 @ args = 0, pretend = 0, frame = 0
 @ frame_needed = 1, uses_anonymous_args = 0
 @ link register save eliminated.
 push {r7}
 add r7, sp, #0
 mov sp, r7
 pop {r7}
 bx lr
 .size f, .-f
 .ident "GCC: (Ubuntu 4.4.2-3ubuntu2) 4.4.2"
 .section .note.GNU-stack,"",%progbits

__sync_lock_test_and_set_* still don't contain a barrier in the right place, though this may be due to the above bug.

00008e04 <__sync_lock_test_and_set_4>:
    8e04: e92d 41f0 stmdb sp!, {r4, r5, r6, r7, r8, lr}
    8e08: f640 76c0 movw r6, #4032 ; 0xfc0
    8e0c: 4605 mov r5, r0
    8e0e: 460f mov r7, r1
    8e10: f6cf 76ff movt r6, #65535 ; 0xffff
    8e14: 682c ldr r4, [r5, #0]
    8e16: 4639 mov r1, r7
    8e18: 462a mov r2, r5
    8e1a: 4620 mov r0, r4
    8e1c: 47b0 blx r6
    8e1e: 2800 cmp r0, #0
    8e20: d1f8 bne.n 8e14 <__sync_lock_test_and_set_4+0x10>
    8e22: 4620 mov r0, r4
    8e24: e8bd 81f0 ldmia.w sp!, {r4, r5, r6, r7, r8, pc}