[GHC] #8219: x86 definition of cas() is wrong
GHC
ghc-devs at haskell.org
Tue Sep 3 16:16:32 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
Keywords: | Operating System: Unknown/Multiple
Architecture: Unknown/Multiple | Type of failure: None/Unknown
Difficulty: Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: |
------------------------------------+-------------------------------------
On x86, `cas()` is defined in SMP.h as (paraphrasing)
{{{
#!c
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.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8219>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list