uname -a: SunOS titania 5.8 Generic_108528-15 sun4u sparc SUNW,Ultra-1 ghc --version: The Glorious Glasgow Haskell Compilation System, version 5.04 gcc --version: 2.95.3
With the files in the attached archive unpacked: ghc hw5.c TestHW5.hs -ffi -package posix -o hw5 -Wall ./hw5 produces output "Hello World" (it works). ghc hw.c TestHW.hs -ffi -package posix -o hw -Wall ./hw produces output "Illegal Instruction" (it doesn't work). However the only difference between the two is that the C function called by TestHW.hs has 6 arguments of type Fd, while that called by TestHW5.hs has only 5. I hope this gets fixed soon; I have just spent an embarassing amount of time tracking down this bug, and I wouldn't like it to bit anyone else.
hw.tar.gz
Description: Binary data
