Skip to content

Unboxed types in GHCi on big-endian platforms

Summary

Consider a file test.hs with content as follows:

{-# LANGUAGE MagicHash #-}
module Main where
import GHC.Exts
data Foo = Foo Float# deriving Show
main = print $ Foo 1.0#

If compiled on s390x via LLVM backend and executed the expected output Foo 1.0# is printed to stdout. However, if interpreted via GHCi, the output is wrong:

> :load test.hs
> main
Foo 0.0#

This might be a big-endian bug. I tried to follow the execution of GHCi via GDB but got lost in to many continuations. I also had a look into parts of GHCi without luck. Any hint which parts of GHCi are responsible for interpreting unboxed types?

This is also the reason why test T13825-debugger fails on s390x.

Note, a similar bug regarding GHCi using :print is fixed by !3649 (closed).

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information