Opened 6 years ago

Closed 6 years ago

#7680 closed bug (invalid)

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

Reported by: slyfox Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.6.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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")
 ,("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")
 ,("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")
 ,("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\"]")

Change History (5)

comment:1 Changed 6 years ago by simonpj

difficulty: Unknown

Does anyone feel able to investigate/characterise this report further? Thanks!


comment:2 Changed 6 years ago by wwiser

Seems to work fine in HEAD:

 ./ghc-stage2 --make Main.hs -prof -fforce-recomp -o Main.buggy && ./Main.buggy
[1 of 1] Compiling Main             ( Main.hs, Main.o )
Linking Main.buggy ...

Ubuntu 12.10 64-bit, i7, gcc 4.7.2

comment:3 Changed 6 years ago by igloo

I can't reproduce this with 7.6.2 on Linux/x86_64 either.

comment:4 Changed 6 years ago by slyfox

My mk/

# Gentoo changes
docdir = /usr/share/doc/ghc-7.6.2
htmldir = /usr/share/doc/ghc-7.6.2
SRC_HC_OPTS+= -optc-march=corei7-avx -opta-march=corei7-avx -optc-mtune=corei7-avx -opta-mtune=corei7-avx -optc-ggdb -optl-Wl,--hash-style=gnu -optc-Wa,--noexecstack -opta-Wa,--noexecstack
SRC_CC_OPTS+=-march=corei7-avx -mtune=corei7-avx -O2 -pipe -ggdb -march=corei7-avx -march=corei7-avx -mtune=corei7-avx -mtune=corei7-avx -ggdb -Wa,--noexecstack -Wa,--noexecstack
SRC_LD_OPTS+= -Wl,--hash-style=gnu

I guess -march breaks some RTS bits.

comment:5 Changed 6 years ago by slyfox

Resolution: invalid
Status: newclosed

Rebuilt ghc with gcc-7.4.2-r1 (gentoo's fix for gcc) and can't reproduce failure anymore.

Sorry for the noise.

Note: See TracTickets for help on using tickets.