x86 definition of cas() is wrong
On x86, cas()
is defined in SMP.h as (paraphrasing)
asm ("lock\ncmpxchg %3,%1"
:"=a"(o), "=m" (*p)
:"0"(o), "r"(n));
But *p is both read and written to, and therefore should have the '+' constraint modifier as opposed to the '=' modifier. Otherwise, the compiler is allowed to elide an earlier write to *p because it thinks that the call to cas()
will overwrite it.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Runtime System |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |