[GHC] #14302: ghc panic on simple program

#14302: ghc panic on simple program -------------------------------------+------------------------------------- Reporter: aberent | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Compile-time Unknown/Multiple | crash or panic Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I am experimenting with Haskell, and am attempting to write a simple maze solver. ghci gives meaningful errors for it, and doesn't crash, but ghc gives {{{ ~/haskell/course$ ghc tiltmaze.hs [1 of 1] Compiling Main ( tiltmaze.hs, tiltmaze.o ) ghc: panic! (the 'impossible' happened) (GHC version 8.0.2 for x86_64-unknown-linux): initTc: unsolved constraints WC {wc_insol = [W] m'_a5Wy :: t_a5Wx[tau:1] (CHoleCan: m') [W] sx'_a5WB :: t_a5WA[tau:1] (CHoleCan: sx') [W] sy'_a5WE :: t_a5WD[tau:1] (CHoleCan: sy')} Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} The code is: {{{ import Data.Sequence as Sequence -- A maze is a grid of empty cells and walls -- true means wall data Maze = Seq (Seq Bool) data Direction = North | South | East | West directions = [North, South, East, West] step :: Direction -> Int -> Int -> (Int, Int) step d x y | North = (x, y-1) | South = (x, y+1) | East = (x+1, y) | West = (x-1, y) solve :: Maze -> Int -> Int -> Int -> Int -> Bool solve m sx sy tx ty | sx == tx && sy == ty = True | otherwise = let solved m x y d | x' < 0 = False | y' < 0 = False | x' >= Sequence.length m = False | y' >= Sequence.length $ m `index` x' = False | not ((m `index` x') `index` y') = False | otherwise = solve m' x' y' tx ty where (x', y') = step d m' = update y False (m `index` x) in any (solved m' sx' sy') directions }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14302 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14302: ghc panic on simple program -------------------------------------+------------------------------------- Reporter: aberent | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by aberent): This appears to be an error in the error handling. Once I fix the compilation errors reported by ghci, ghc is happy to compile it. FYI my fixed code is: {{{ module Tiltmaze (solve) where import Data.Sequence as Sequence -- A maze is a grid of empty cells and walls -- true means wall type Maze = Seq (Seq Bool) data Direction = North | South | East | West deriving (Eq, Show) directions = [North, South, East, West] step :: Direction -> Int -> Int -> (Int, Int) step d x y | d == North = (x, y-1) | d == South = (x, y+1) | d == East = (x+1, y) | d == West = (x-1, y) solve :: Maze -> Int -> Int -> Int -> Int -> Bool solve m sx sy tx ty | sx == tx && sy == ty = True | otherwise = let solved m x y d | x' < 0 = False | y' < 0 = False | x' >= Sequence.length m = False | y' >= Sequence.length (m `index` x') = False | not ((m `index` x') `index` y') = False | otherwise = solve m' x' y' tx ty where (x', y') = step d x y m' = update x (update y False (m `index` x)) m in any (solved m sx sy) directions }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14302#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14302: ghc panic on simple program -------------------------------------+------------------------------------- Reporter: aberent | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Thanks for the bug report. This is a duplicate of #13106, and has been fixed in GHC 8.2. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14302#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14302: ghc panic on simple program -------------------------------------+------------------------------------- Reporter: aberent | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.0.2 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Compile-time | Unknown/Multiple crash or panic | Test Case: Blocked By: | Blocking: Related Tickets: #13106 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * status: new => closed * version: 8.2.1 => 8.0.2 * resolution: => duplicate * related: => #13106 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14302#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC