Re: [GHC] #7411: Exceptions are optimized away in certain situations

#7411: Exceptions are optimized away in certain situations -------------------------------------+------------------------------------- Reporter: SimonHengel | Owner: (none) Type: bug | Status: new Priority: high | Milestone: 8.6.1 Component: Compiler | Version: 7.6.1 Resolution: | Keywords: seq, deepseq, | evaluate, exceptions Operating System: Linux | Architecture: x86_64 | (amd64) Type of failure: Incorrect result | Test Case: at runtime | simplCore/should_fail/T7411 Blocked By: | Blocking: Related Tickets: #5129 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by tdammers): The relevant Core for the unoptimized run: {{{ main = evaluate (deepseq ($fNFData[] $fNFDataChar) (: (C# 'a'#) (undefined ((pushCallStack (unpackCString# "undefined"#, SrcLoc (unpackCString# "main"#) (unpackCString# "Main"#) (unpackCString# "example.hs"#) (I# 4#) (I# 25#) (I# 4#) (I# 34#)) emptyCallStack) `cast` Co:4))) (return $fMonadIO ())) }}} As expected, `deepseq` is retained. However, in the optimized version, we get this: {{{ Rec { main_go main_go = \ ds_a2Nc -> case ds_a2Nc of { [] -> (); : x_a2Ng xs_a2Nh -> case x_a2Ng of { C# ipv_s2Np -> main_go xs_a2Nh } } end Rec } main2 main2 = undefined (lvl10_r4dT `cast` Co:4) lvl11_r4dU lvl11_r4dU = C# 'a'# lvl12_r4dV lvl12_r4dV = : lvl11_r4dU main2 lvl13_r4dW lvl13_r4dW = \ eta_B1 -> case main_go lvl12_r4dV of { () -> (# eta_B1, () #) } main1 main1 = \ s_a2Nw -> (# s_a2Nw, lvl13_r4dW `cast` Co:3 #) }}} (boilerplate stripped for clarity) Which, IIUC, does not respect the spirit of `deepseq` - specifically, the list construction in `lvl12_r4dV` isn't strict, so the `undefined` that `main2` produces isn't being forced. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/7411#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC