logo       

RE: -fvia-c -O generates mal-typed C code (casts double via unsignedint): msg#00009

lang.haskell.glasgow.bugs

Subject: RE: -fvia-c -O generates mal-typed C code (casts double via unsignedint)

On 07 August 2004 18:53, Duncan Coutts wrote:

> The problem shows up as a double value loosing precision when it is
> sent
> to C land and back. It's because ghc generates C code that casts the
> value via an unsigned word when it gets it back from C land.
[ bug report snipped ]

Thanks for an excellent report. I knew what the bug was without trying
out the code.

Unfortunately, it's not easily fixed. There's a part of the code
generator that needs to get hold of some unique temporaries, and there
isn't a supply of uniques to hand, so it always picks the same ones.

This bug is already fixed in the new backend (which will be 6.4).

I've committed a partial workaround for the bug to the HEAD, and will
merge it into 6.2.2. The workaround fixes your program, but it will
fail if you use 'safe' (instead of 'unsafe') ccalls. Fortunately, it
also improves performance :-)

Cheers,
Simon


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise