big FFI bug in x86_64

Simon Marlow simonmar at microsoft.com
Fri Apr 22 06:22:36 EDT 2005


On 22 April 2005 01:20, John Meacham wrote:

> ghc 6.4 x86_64 appears to be interpreting
> foreign import "&foo" as importing the value of foo rather than the
> address of foo.
> 
> I wrote a test case that demonstrates this problem here
> http://repetae.net/john/ghc-bug.tar.gz
> 
> correct output:
> 
> ;./foo
> ()
> 0x080774f0
> 0x080774f4
> 0xdeadbeef
> 
> incorrect output:
> 
> ;./foo
> ()
> 0x00000000deadbeef
> 0xffffffffdeadbeef
> zsh: segmentation fault (core dumped)  ./foo

It's actually a bug in the via-C code generator, but you're seeing it on
x86_64 because of the lack of a native code generator on that platform.

I think I've fixed it now, after testing I'll merge into the 6.4 branch.

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list