-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
Description
| Bugzilla Link | 32020 |
| Resolution | FIXED |
| Resolved on | Oct 12, 2018 04:05 |
| Version | 4.0 |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @orgads,@atanasyan |
Extended Description
Hi,
Testcase:
int main(void)
{
volatile int obj = 1;
int x = obj;__atomic_compare_exchange_n(&obj, &x, 0, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED);}
Compiling with:
clang-4.0 -O0 test.c -otes
Running "test" hangs on Cavium Octeon machines. The bug does not occur if -O1 is used.
The generated assembly contains this loop:
.LBB0_1:
ld $1, 16($fp)
ll $2, 0($1)
lw $3, 32($fp)
sw $2, 12($fp)
bne $2, $3, .LBB0_3
nop
lw $1, 28($fp)
ld $2, 16($fp)
sc $1, 0($2)
beqz $1, .LBB0_1
nop
However the Octeon processor manual states that any store will cause a subsequent sc instruction to fail and therefore this above loop will never complete on Octeon.
Thanks,
James