[GHC] #10538: Simpilifier produces empty case in core, segfaults at runtime.

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.2-rc1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- In attachment is a cabal project which builds program producing segfault. Bug is affected by inlining, so test had to be split into modules. Otherwise bug did not occur, and NOINLINE pragmas didn't seem to help. Can probably be simplified much more, right now it requires some basic packages. Inspecting the core I've found that code for `r` in `main` ends with empty `case`, but should end with match on Either constructors with `show`. It fails on 7.10.1 and 7.10.2-rc1. Works on 7.8.3. It seems to be affected by inlining. For example inlining validateJson from Validator/Aeson.hs helps. Is also seems to be affected by specializing functions in Main.hs to Indentity monad. For convenience I've also put test case to https://github.com/sopvop/failidator failit.sh will init sandbox, install deps, build executable and run it. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by bgamari): * owner: => bgamari * failure: None/Unknown => Runtime crash * priority: normal => high * milestone: => 7.10.2 Comment: Oh dear. This does look like quite a bad regression. Indeed I can reproduce it here. I'll dig in a bit tonight. I'm going to milestone this for 7.10.2 as it's a crash in pure code which worked in 7.8. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by int-e): Sorry, I meant to add a description to that file: It reproduces the same bug with a bit less code and a single file (note the strategically placed `NOINLINE`). Interestingly, the `Applicative` constraint on `reqField` is essential. I've looked a bit at the resulting traces, but I'm not sure what to look for. Here are two excerpts that I found interesting: http://lpaste.net/raw/2270642354903842816 looks like an inlining step going horribly wrong, and http://lpaste.net/6349604574378065920 shows how the odd duplicated `a1_X9lA` is introduced. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by simonpj): Ah! I have nailed this. Patch coming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: new Priority: high | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by bgamari): This is very good news as the Rackspace machine that I was using to bisect this just inexplicably vanished, along with my bisection state. Thanks Simon! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime.
-------------------------------------+-------------------------------------
Reporter: sopvop | Owner: bgamari
Type: bug | Status: new
Priority: high | Milestone: 7.10.2
Component: Compiler | Version: 7.10.2-rc1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: Runtime crash | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by simonpj): * priority: high => highest * status: new => merge Comment: Let's merge this to 7.10.2 if possible. It is a hard error. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#10538: Simpilifier produces empty case in core, segfaults at runtime. -------------------------------------+------------------------------------- Reporter: sopvop | Owner: bgamari Type: bug | Status: closed Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.2-rc1 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Runtime crash | Unknown/Multiple Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged to `ghc-7.10`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10538#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC