Skip to content

-prof build: trying to 'show' a 'Double' leads to 'Char.intToDigit: not a digit' crash

The source is very simple:

main :: IO ()
main = putStrLn $ show (1 :: Double)

Run as:

ghc --make double.hs -prof -fforce-recomp -o double.buggy && ./double.buggy

Dies as:

[1 of 1] Compiling Main ( 144.hs, 144.o )

Linking double.buggy ...

double.buggy: Char.intToDigit: not a digit 7488688

It's an amd64 gentoo linux with **gcc-4.7.2**. Core i7 system with avx support.

If I drop **-prof** the bug goes away. If I change **Double** to **Float**, **Int**, **Integer** the bug goes away.

I might have miscompiled RTS or something. Which is the best way to verify?

 [("Project name","The Glorious Glasgow Haskell Compilation System")
 ,("GCC extra via C opts"," -fwrapv")
 ,("C compiler command","x86_64-pc-linux-gnu-gcc")
 ,("C compiler flags"," -fno-stack-protector  -Wl,--hash-size=31 -Wl,--reduce-memory-overheads")
 ,("ar command","/usr/bin/ar")
 ,("ar flags","q")
 ,("ar supports at file","YES")
 ,("touch command","touch")
 ,("dllwrap command","/bin/false")
 ,("windres command","/bin/false")
 ,("perl command","/usr/bin/perl")
 ,("target os","OSLinux")
 ,("target arch","ArchX86_64")
 ,("target word size","8")
 ,("target has GNU nonexec stack","True")
 ,("target has .ident directive","True")
 ,("target has subsections via symbols","False")
 ,("LLVM llc command","/usr/bin/llc")
 ,("LLVM opt command","/usr/bin/opt")
 ,("Project version","7.6.2")
 ,("Booter version","7.6.2")
 ,("Stage","2")
 ,("Build platform","x86_64-unknown-linux")
 ,("Host platform","x86_64-unknown-linux")
 ,("Target platform","x86_64-unknown-linux")
 ,("Have interpreter","YES")
 ,("Object splitting supported","YES")
 ,("Have native code generator","YES")
 ,("Support SMP","YES")
 ,("Unregisterised","NO")
 ,("Tables next to code","YES")
 ,("RTS ways","l debug  thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn")
 ,("Leading underscore","NO")
 ,("Debug on","False")
 ,("LibDir","/usr/lib64/ghc-7.6.2")
 ,("Global Package DB","/usr/lib64/ghc-7.6.2/package.conf.d")
 ,("Gcc Linker flags","[\"-Wl,--hash-size=31\",\"-Wl,--reduce-memory-overheads\"]")
 ,("Ld Linker flags","[\"--hash-size=31\",\"--reduce-memory-overheads\"]")
 ]
Trac metadata
Trac field Value
Version 7.6.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information