
I believe this is a known issue in http://ghc.haskell.org/trac/ghc/ticket/5550 and http://ghc.haskell.org/trac/ghc/ticket/7944 ?
could you try compiling the code with HEAD and see if the error is still
#8425: ghc-7.6.3: crossmodule inline leads to buggy code (-O2) -------------------------------------+---------------------------------- Reporter: slyfox | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+---------------------------------- Comment (by slyfox): Replying to [comment:1 carter]: there? Yeah, head works: # ./run_test.bash ... ,("Project version","7.7.20131009") ,("Booter version","7.6.3") ,("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") ,("Tables next to code","YES") ,("RTS ways","l debug thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn thr_debug_dyn l_dyn thr_l_dyn") ,("Support dynamic-too","YES") ,("Support parallel --make","YES") ,("Dynamic by default","NO") ,("GHC Dynamic","YES") ,("Leading underscore","NO") ,("Debug on","False") ,("LibDir","/var/tmp/portage/dev- lang/ghc-9999/work/ghc-9999/inplace/lib") ,("Global Package DB","/var/tmp/portage/dev- lang/ghc-9999/work/ghc-9999/inplace/lib/package.conf.d") ] RUN good [1 of 2] Compiling Susp ( good/Susp.hs, good/Susp.o ) [2 of 2] Compiling Main ( good/main.hs, good/main.o ) Linking good/main ... (fromList [(array (0,0) [(0,42)],0)],0) RUN bad [1 of 3] Compiling BuggyOpt ( bad/BuggyOpt.hs, bad/BuggyOpt.o ) [2 of 3] Compiling Susp ( bad/Susp.hs, bad/Susp.o ) [3 of 3] Compiling Main ( bad/main.hs, bad/main.o ) Linking bad/main ... (fromList [(array (0,0) [(0,42)],0)],0) But why are those bugs related to this issue? AFAIU they are compile-time issues. May I ask you to point to related commitspossibly fixing this? And what workaround would you suggest for this particular code? I'm using {-# NOINLINE #-} in random places inside miscompiled function. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8425#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler