[GHC] #8219: x86 definition of cas() is wrong
GHC
ghc-devs at haskell.org
Tue Sep 3 23:36:56 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 parcs):
Sorry, my original test case is needlessly convoluted. Here's a more
straightforward one:
=== cas.c
{{{
#!c
#include <assert.h>
static int
cas (int *p, int o, int n)
{
asm ("lock cmpxchg %3,%1"
:"=a"(o), "=m"(*(volatile int *)p)
:"0"(o), "r"(n));
return o;
}
int v;
int
main (int argc, char **argv)
{
v = 42;
cas (&v, 42, 1);
assert(v == 1);
return 0;
}
}}}
=== Command Line
{{{
$ gcc -O2 cas.c
$ ./a.out
a.out: cas.c:19: main: Assertion `v == 1' failed.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8219#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list