[GHC] #9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS)))))

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) ------------------------------------+------------------------------------- Reporter: luite | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- tested with GHC 7.8 branch commit 32b4bf33989bdda4dffed1866f7a61a7da4ca275 and GHC 7.8.2 compile with -O or -O2 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * testcase: => stranal/should_compile/T9208 Comment: Good point, thank you. In the test program you use `unsafeCoerce`, and in fact you end up doing something like {{{ (coerce ()) arg }}} that is, you take `()` (produced by `loadTHData`) and apply it to something (in `runTH`). So you are going to get some bizarre runtime crash. Maybe your real example was not as perverse as this one. But regardless, it shouldn't crash the compiler, I agree. I've fixed that; patch coming. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by luite): Yes, in my real code I'm not quite doing this, but since it's part of the ghcjs-prim package I had to remove some code (`foreign import javascript`) that's not supported by normal GHC. The actual `loadTHData` would do some JavaScript runtime calls to load the code in the `ByteString`, initialise the info tables and then return a closure of the expected type. It's part of my work to decouple Template Haskell from the GHC process and thus the host platform. GHC sets up a connection to a TH service and incrementally sends compiled code (target architecture) to it, the TH service can query GHC for reification. For GHCJS this is a node.js server, but when when my proof of concept works, I'll ask on ghc-devs if there's interest in extending this for general cross compilation in GHC. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS)))))
-------------------------------------------------+-------------------------
Reporter: luite | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Test Case: stranal/should_compile/T9208 | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
-------------------------------------------------+-------------------------
Comment (by Simon Peyton Jones

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by simonpj): * status: new => merge Comment: Fix is above. Merge to 7.8 when it's next convenient. Luite: yell if you really, really need this in 7.8.3. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by luite): Thanks for the fix. I have a workaround, so for me it's not essential for it to be in 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by nomeata): There is something wrong with the test case. With `-DDEBUG`, I get {{{ Compile failed (status 256) errors were: ghc-stage2: panic! (the 'impossible' happened) (GHC version 7.9.20140622 for x86_64-unknown-linux): ASSERT failed! file compiler/codeGen/StgCmmExpr.hs, line 643 Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug *** unexpected failure for T9208(optasm) }}} (full log at https://s3.amazonaws.com/archive.travis- ci.org/jobs/28166586/log.txt) while it worked without `-DDEBUG`. (Didn’t look into it deeper. Greetings from OPLSS! :-)) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by simonpj): No, there's nothing wrong with the test case, but I should have commented on it. There really is a terrible bug in the program: it takes the value `()`, unsafely casts it to a function, and applies it. As it happens the ASSERT in `StgCmmExpr` can see this happening, and complains. (But a slightly more complicated example might conceal the problem.) So something bizarre is going to happen, but that's what the programmer asked for. In general GHC should never crash, no matter how bizarre the program. You could argue for a civilised error messaage. Or you could argue to remove the ASSERT. But I don't want to spend precious cycles thinking about programs that are wrong anyway. The strongest case for doing something is that building stage-2 with `-DDEBUG` is really a good plan for flushing out latent bugs, but this test will make it look as if there is a failure. I'm open to suggestions about how to fix that. Perhaps the best way would be to switch on `CmmLint` as well as `-DDEBUG`, and make sure `CmmLint` detects this particular problem. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by thoughtpolice): * milestone: => 7.8.3 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS)))))
-------------------------------------------------+-------------------------
Reporter: luite | Owner:
Type: bug | Status: merge
Priority: normal | Milestone: 7.8.3
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Test Case: stranal/should_compile/T9208 | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
-------------------------------------------------+-------------------------
Comment (by Joachim Breitner

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS)))))
-------------------------------------------------+-------------------------
Reporter: luite | Owner:
Type: bug | Status: merge
Priority: normal | Milestone: 7.8.3
Component: Compiler | Version: 7.8.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Test Case: stranal/should_compile/T9208 | Difficulty:
Blocking: | Unknown
| Blocked By:
| Related Tickets:
-------------------------------------------------+-------------------------
Comment (by Simon Peyton Jones

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: Priority: normal | closed Component: Compiler | Milestone: 7.8.3 Resolution: fixed | Version: 7.8.2 Operating System: Unknown/Multiple | Keywords: Type of failure: None/Unknown | Architecture: Test Case: stranal/should_compile/T9208 | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by thoughtpolice): * status: merge => closed * resolution: => fixed Comment: Merged into 7.8.3. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by thoughtpolice): * status: closed => merge Comment: Aw crap, I forgot to merge the last two changes to the testsuite as well to mark T9208 as broken. Those will be incoming soon. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by dfeuer): Wouldn't it be more correct to remove the assertion and try to come up with a better one in a future release than to ship with an invalid assertion? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: merge Priority: normal | Milestone: 7.8.3 Component: Compiler | Version: 7.8.2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: None/Unknown | Unknown/Multiple Test Case: stranal/should_compile/T9208 | Difficulty: Blocking: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Comment (by simonpj): Probably. Feel free to have a go. It's so much a corner case that I can't bear to spend the time to think about it. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9208: panic - attempt to prod-split strictness call demand C(S(C(C(S(LS))))) -------------------------------------------------+------------------------- Reporter: luite | Owner: Type: bug | Status: Priority: normal | closed Component: Compiler | Milestone: 7.8.3 Resolution: fixed | Version: 7.8.2 Operating System: Unknown/Multiple | Keywords: Type of failure: None/Unknown | Architecture: Test Case: stranal/should_compile/T9208 | Unknown/Multiple Blocking: | Difficulty: | Unknown | Blocked By: | Related Tickets: -------------------------------------------------+------------------------- Changes (by thoughtpolice): * status: merge => closed Comment: OK, merged. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9208#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC