[GHC] #13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- The bug can be reproduced but it does take some setup. Here's the error report in case it's familiar: {{{ ... [1 of 2] Compiling Valuators ( .stack- work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- fluid-valuators-tmp/Valuators.hs, .stack- work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- fluid-valuators-tmp/Valuators.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170507 for x86_64-unknown-linux): idInfo a_ad4D Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} The bug is a GUI binding. Reproducing is reliable but unfortunately takes some setup. To reproduce: {{{ # Install the FLTK GUI toolkit from source.
wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-1-source.tar.gz tar -zxf fltk-1.3.4-1-source.tar.gz cd fltk-1.3.4-1 ./configure --enable-gl --enable-shared --enable-localjpeg --enable- localzlib --enable-localpng make sudo make install fltk-config --version 1.3.4-1
# Install the bindings from source
git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs cd fltkhs cabal install
# Install the package causing the bug from source
git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs-fluid-demos cd fltkhs-fluid-demos cabal install }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by deech: @@ -26,2 +26,1 @@ - The bug is a GUI binding. Reproducing is reliable but unfortunately takes - some setup. To reproduce: + The bug is in a demo for a GUI binding. To reproduce: New description: The bug can be reproduced but it does take some setup. Here's the error report in case it's familiar: {{{ ... [1 of 2] Compiling Valuators ( .stack- work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- fluid-valuators-tmp/Valuators.hs, .stack- work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- fluid-valuators-tmp/Valuators.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170507 for x86_64-unknown-linux): idInfo a_ad4D Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} The bug is in a demo for a GUI binding. To reproduce: {{{ # Install the FLTK GUI toolkit from source.
wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-1-source.tar.gz tar -zxf fltk-1.3.4-1-source.tar.gz cd fltk-1.3.4-1 ./configure --enable-gl --enable-shared --enable-localjpeg --enable- localzlib --enable-localpng make sudo make install fltk-config --version 1.3.4-1
# Install the bindings from source
git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs cd fltkhs cabal install
# Install the package causing the bug from source
git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs-fluid-demos cd fltkhs-fluid-demos cabal install }}}
-- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Description changed by deech: @@ -1,2 +1,3 @@ - The bug can be reproduced but it does take some setup. Here's the error - report in case it's familiar: + The following causes a panic in GHC 8.2.1 rc2: + {{{ + module Main where @@ -4,18 +5,5 @@ - {{{ - ... - [1 of 2] Compiling Valuators ( .stack- - work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- - fluid-valuators-tmp/Valuators.hs, .stack- - work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-fluid-valuators/fltkhs- - fluid-valuators-tmp/Valuators.o ) - ghc: panic! (the 'impossible' happened) - (GHC version 8.2.0.20170507 for x86_64-unknown-linux): - idInfo - a_ad4D - Call stack: - CallStack (from HasCallStack): - prettyCurrentCallStack, called at - compiler/utils/Outputable.hs:1134:58 in ghc:Outputable - callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in - ghc:Outputable - pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var + indexOr :: a -> Int -> [a] -> a + indexOr fallback idx xs = + if (idx < length xs) + then xs !! idx + else fallback @@ -23,1 +11,2 @@ - Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug + main :: IO () + main = undefined @@ -26,1 +15,17 @@ - The bug is in a demo for a GUI binding. To reproduce: + When compiling I get: + {{{ + [1 of 1] Compiling Main ( src/Examples/table-sort.hs, + .stack-work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-table-sort + /fltkhs-table-sort-tmp/Main.o ) + ghc: panic! (the 'impossible' happened) + (GHC version 8.2.0.20170507 for x86_64-unknown-linux): + idInfo + a_a2ws + Call stack: + CallStack (from HasCallStack): + prettyCurrentCallStack, called at + compiler/utils/Outputable.hs:1134:58 in ghc:Outputable + callStackDoc, called at compiler/utils/Outputable.hs:1138:37 + in ghc:Outputable + pprPanic, called at compiler/basicTypes/Var.hs:526:34 in + ghc:Var @@ -28,21 +33,2 @@ - {{{ - # Install the FLTK GUI toolkit from source. - > wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-1-source.tar.gz - > tar -zxf fltk-1.3.4-1-source.tar.gz - > cd fltk-1.3.4-1 - > ./configure --enable-gl --enable-shared --enable-localjpeg --enable- - localzlib --enable-localpng - > make - > sudo make install - > fltk-config --version - 1.3.4-1 - - # Install the bindings from source - > git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs - > cd fltkhs - > cabal install - - # Install the package causing the bug from source - > git clone -b 8.2.1-rc2 https://github.com/deech/fltkhs-fluid-demos - > cd fltkhs-fluid-demos - > cabal install + Please report this as a GHC bug: + http://www.haskell.org/ghc/reportabug New description: The following causes a panic in GHC 8.2.1 rc2: {{{ module Main where indexOr :: a -> Int -> [a] -> a indexOr fallback idx xs = if (idx < length xs) then xs !! idx else fallback main :: IO () main = undefined }}} When compiling I get: {{{ [1 of 1] Compiling Main ( src/Examples/table-sort.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-table-sort /fltkhs-table-sort-tmp/Main.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170507 for x86_64-unknown-linux): idInfo a_a2ws Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): I can't reproduce this, what exact command are you using to compile? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by deech): The problem is possibly being caused by some ghc options I'm using. I've created a self contained repo [1] that reproduces the bug on my machine when building with 'stack build'. It should work for 'cabal install' as well. [1] https://github.com/deech/821rc2-panic-bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): I can reproduce this now with {{{ /usr/local/bin/ghc-8.2.0.20170507 -O src/821rc2-panic-bug.hs '-fmax- simplifier-iterations=0' -fforce-recomp }}} The `-O` and `-fmax-simplifier-iterations` are both necessary. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by deech): Does one of these other flags [1] imply `-O` because I don't explicitly use it in the example? [1] https://github.com/deech/821rc2-panic-bug/blob/master/821rc2-panic- bug.cabal#L22 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): I pasted the command line which cabal runs (which you can find by using `-v`) and removed arguments. Cabal compiles executables with -O by default I think. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): FWIW, commit 8d5cf8bf584fd4849917c29d82dcf46ee75dd035 (Join points) is the culprit here. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): Patch incoming -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2
-------------------------------------+-------------------------------------
Reporter: deech | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1-rc2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13708 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => simplCore/should_compile/T13708 * resolution: => fixed Comment: Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13708 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: closed => merge * milestone: => 8.2.1 @@ -2,1 +2,1 @@ - {{{ + {{{#!hs New description: The following causes a panic in GHC 8.2.1 rc2: {{{#!hs module Main where indexOr :: a -> Int -> [a] -> a indexOr fallback idx xs = if (idx < length xs) then xs !! idx else fallback main :: IO () main = undefined }}} When compiling I get: {{{ [1 of 1] Compiling Main ( src/Examples/table-sort.hs, .stack-work/dist/x86_64-linux/Cabal-2.0.0.0/build/fltkhs-table-sort /fltkhs-table-sort-tmp/Main.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.2.0.20170507 for x86_64-unknown-linux): idInfo a_a2ws Call stack: CallStack (from HasCallStack): prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1134:58 in ghc:Outputable callStackDoc, called at compiler/utils/Outputable.hs:1138:37 in ghc:Outputable pprPanic, called at compiler/basicTypes/Var.hs:526:34 in ghc:Var Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} -- Comment: I suspect we should merge this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: merge Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13708 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): For the record, `T13708` fails on `ghc-8.2` even with comment:10 due to a call to `setIdDemandInfo` in `DmdAnal.hs`, around line 300. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13708: Panic! (the "impossible" happened) bug in GHC 8.2.1 rc2 -------------------------------------+------------------------------------- Reporter: deech | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.2.1-rc2 Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: | simplCore/should_compile/T13708 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: merge => closed Comment: Merged to `ghc-8.2` in c7d809928d87a7a54bcea6badea3e7ee5f7181db but marked test as `expect_broken` due to comment:13. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13708#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC