[GHC] #10288: -flate-dmd-anal triggers "Entered absent arg"
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Runtime crash Unknown/Multiple | Blocked By: Test Case: | Related Tickets: Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- If I compile my program with -flate-dmd-anal, it crashes at run-time with {{{Oops! Entered absent arg w_sJ66e M V1 Double}}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 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 rwbarton): * status: new => infoneeded Comment: Could you attach your program (preferably after minimizing it as much as possible)? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 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): Yes indeed! You should ''never'' get "Entered absent arg", so there's an outright bug there. But we can't fix it unless we can reproduce it. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 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 yongqli): See Main.hs here: https://gist.github.com/yongqli/5dc94aeaeda2e24c6637 You need the following packages: {{{ linear, lens, vector, vector-th- unbox, strict }}} Running with {{{ ghc Main.hs -O2 -flate-dmd-anal -fforce-recomp; ./Main }}} will give {{{ Main: Oops! Entered absent arg w_sGY6 MVN V1 Double }}} It takes about 3 days's worth of work to produce a test case like this. Is there a better option than deleting a piece of code and then recompiling? I essentially have to "unwrite" my whole program. Is there a fuzzer-like tool that could conceivably be used? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 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): Good news. I think this is fixed. At least I can't reproduce your crash with HEAD. I think that one of these two fixes has solved it: * #10218 * #10148 Both are merged to the 7.10 branch and so will appear in 7.10.2. It would be good if you were able to test that the 7.10 branch is indeed fixed in your case. I will try to do the same. Simon PS: for "entered absent arg w_sJ66e" bugs, compile with "-ddump-simpl" and grep for that string. That will show exactly which thunk in which function is being entered, and might save time compared to delete/recompile. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: Component: Compiler | Version: 7.10.1 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): Oh VERY interesting! I have reproduced the problem with 7.10, and it is YET ANOTHER bug in the demand analyser. Here is the offending code {{{ dmdAnal' sigs dmd (App fun (Coercion co)) = (fun_ty, App fun' (Coercion co)) where (fun_ty, fun') = dmdAnal sigs dmd fun }}} The incoming demand `dmd` is not modified before passing it on to `fun`. But that is wrong wrong wrong. That gets the demands from the function out of step, so the wrong demand goes to the wrong argument. It's a miracle that this has not been causing chaos for ages. Horror. Coercions are ''value'' arguments and so they must be treated as such. I think the solution is simply to delete these lines so that coercion arguments are handled uniformly; but I want to tread carefully. Thank you for extracting this example. More anon. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: infoneeded Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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 thoughtpolice): * milestone: => 7.10.2 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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 thoughtpolice): * status: infoneeded => new -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:7> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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 thoughtpolice): * owner: => simonpj -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:8> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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 <simonpj@…>): In [changeset:"d5773a4939b1feea51ec0db6624c9462751e948a/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="d5773a4939b1feea51ec0db6624c9462751e948a" Teach DmdAnal that coercions are value arguments! The demand analyser was treating coercion args like type args, which meant that the arguments in a strictness signature got out of step with the arguments of a call. Result chaos and disaster. Trac #10288 showed it up. It's hard to get this bug to show up in practice because - functions abstracted over coercions are usually abstracted over *boxed* coercions - we don't currently unbox a boxed-coercion arg because it's GADT (I see how to fix this too) But after floating, optimisation, and so on, Trac #10288 did get a function abstracted over an unboxed coercion, and then the -flate-dmd-anal pass went wrong. I don't think I can come up with a test case, but I don't think it matters too much. Still to come - Fix a second bug, namely that coercion variables are wrongly marked as absent because DmdAnal doesn't check the the free variables of casts. I think this never bites in practice (see the follow-up commit) - Make GADT products work with strictness analysis }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:9> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: new Priority: normal | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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 <simonpj@…>): In [changeset:"5c7e4db5ce84395eb0d727eb3b0f505a00191164/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="5c7e4db5ce84395eb0d727eb3b0f505a00191164" Wibble to DmdAnal This fixes a typo in d5773a4939b1feea51ec0db6624c9462751e948a Teach DmdAnal that coercions are value arguments! (Trac #10288) Sorry about that; I'm not sure how it slipped through. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:10> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: merge Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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: normal => highest * status: new => merge Comment: yongqli, your test case nailed it -- thank you! It was so helpful to be able to reproduce it, and it's not an easy case to make happen, so I might well have failed to find it, or assumed it was already fixed, without your help. Austin: please merge the above two to 7.10. I'm not adding a regression test because it's hard to provoke; and the fix (which consisted only of deleting code) is pretty robust. Simon -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:11> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: closed Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 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` (via 354f5063bac6a91d06f5e37777d594b3140dc668). -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:12> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#10288: -flate-dmd-anal triggers "Entered absent arg" -------------------------------------+------------------------------------- Reporter: yongqli | Owner: simonpj Type: bug | Status: closed Priority: highest | Milestone: 7.10.2 Component: Compiler | Version: 7.10.1 Resolution: fixed | 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): Note that the commit to the `ghc-7.10` branch has a typo. I've opened Phab:D881 to fix this. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10288#comment:13> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC