ghci and unboxed ints

Donald Bruce Stewart dons at cse.unsw.edu.au
Tue May 4 07:05:01 EDT 2004


dons:
> josefs:
> > Hi,
> > 
> > I just played randomly with ghci for a while and encountered the following
> > rather odd behaviour:
> > 
> > Prelude> :m GHC.Base
> > Prelude GHC.Base> let a = 1# +# 2#
> > Prelude GHC.Base> show (I# a)
> > "18345984"
> > 
> > The number shown is the one I got when running on Solaris. I get a
> > different one when running on Windows. It doesn't matter which numbers I
> > add, the same number is always shown.
> > 
> > Reproducible with 6.2 and 6.2.1.
> 
> I don't know what the issue is, but it is interesting:
> 
>         Prelude> :m GHC.Base
>         Prelude GHC.Base> case 1# +# 2# of a -> show (I# a)
>         "3"
>         Prelude GHC.Base> let a = 1# +# 2#
>         Prelude GHC.Base> show (I# a)
>         "1085417808"
> 
> $ ghci --version
> The Glorious Glasgow Haskell Compilation System, version 6.3.20040202

And, just for fun (since I don't know enough ghci to help):

        $ ghci --version
        The Glorious Glasgow Haskell Compilation System, version 6.2

        $ uname -msr
        Linux 2.6.0-test9 ia64

        Loading package base ... linking ... done.
        Prelude> :m GHC.Base
        Prelude GHC.Base> case 1# +# 2# of a -> show (I# a)
        "3"
        Prelude GHC.Base> let a = 1# +# 2#
        Prelude GHC.Base> show (I# a)
        zsh: segmentation fault  ghci -fglasgow-exts

-- Don


More information about the Glasgow-haskell-bugs mailing list