#2209: MagicHash extraction is wrong on x86_64 with -fasm -O2
----------------------+-----------------------------------------------------
Reporter: quark | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone: 6.8.3
Component: Compiler | Version: 6.8.2
Severity: major | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: x86_64 (amd64)
Os: Linux |
----------------------+-----------------------------------------------------
Changes (by simonmar):
* owner: => simonmar
Comment:
Replying to [comment:2 igloo]:
> We do claim that this ("Casting an unboxed type to another unboxed type
of the same size") works in the `unsafeCoerce#` docs, so we ought to fix
it!
I'm tempted to alter the docs here. The problem is that the Cmm generated
for this program has a type error, which you can see by compiling with
`-dcmm-lint`. This breaks some assumptions that the native code generator
is making, with the result that it ends up being confused about floating
point vs. scalar register assignments.
You can achieve the desired effect using castSTUArray, incedentally (this
is the way we do it in GHC).
To make the direct coercion work, we'd have to make the `unsafeCoerce#`
really compile into an operation at the Cmm level. Which is possible, but
we'd have to add new primitives for the operation (the current float->int
conversions do truncation, not bit-for-bit conversion), and add some code
to CoreToStg to generate the operations.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2209#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs