[GHC] #8219: x86 definition of cas() is wrong
GHC
ghc-devs at haskell.org
Mon Sep 23 15:12:35 CEST 2013
#8219: x86 definition of cas() is wrong
-------------------------------------+------------------------------------
Reporter: parcs | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Runtime System | Version: 7.7
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture: Unknown/Multiple
Type of failure: None/Unknown | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
-------------------------------------+------------------------------------
Comment (by Patrick Palka <patrick@…>):
In [changeset:84dff71075b915938e2457f5bff2d127eac3b3cc/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="84dff71075b915938e2457f5bff2d127eac3b3cc"
Fix the definition of cas() on x86 (#8219)
*p is both read and written to by the cmpxchg instruction, and therefore
should be given the '+' constraint modifier.
(In GCC's extended ASM language, '+' means that the operand is both read
and written to whereas '=' means that it is only written to.)
Otherwise, the compiler is allowed to rewrite something like
SpinLock lock;
initSpinLock(&lock); /* sets lock = 1 */
ACQUIRE_SPIN_LOCK(&lock);
into
SpinLock lock;
ACQUIRE_SPIN_LOCK(&lock);
because according to the asm statement, the previous value of 'lock' is
not important.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8219#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list