#15443 closed bug (duplicate)

ghc panic when running GI.init on intero REPL

Reported by: esclerofilo Owned by:
Priority: normal Milestone: 8.8.1
Component: GHCi Version: 8.4.3
Keywords: Cc:
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: GHCi crash Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:

Description

I cloned the https://github.com/haskell-gi/gi-gtk-examples repo to learn to use gi-gtk, deleted all version numbers in the .cabal file to make it build with the latest stack resolver (lts-12.2) and then opened ButtonBox.hs in emacs (spacemacs) with intero, opened the intero repl (without actually loading the buffer into the repl*) and what happened follows:

Starting:
  stack ghci --with-ghc ghci "--docker-run-args=--interactive=true --tty=false" --no-build --no-load gi-gtk-examples
GHCi, version 8.4.3: http://www.haskell.org/ghc/  :? for help
Loaded GHCi configuration from /home/vicente/Escritorio/gi-gtk-examples/.stack-work/intero/intero-scriptBbJ8Bq
λ import qualified GI.Gtk as GI (main, init)
λ GI.init Nothing
ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.3 for x86_64-unknown-linux):
	nameModule
  system $dShow_a8qH
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

the contents of /home/vicente/Escritorio/gi-gtk-examples/.stack-work/intero/intero-scriptBbJ8Bq are:

:set prompt ""
:set -fbyte-code
:set -fdefer-type-errors
:set -fdiagnostics-color=never
:set prompt "\4 "

Note: It happens on a terminal ghci invocation too, given the same parameters and configuration.

Change History (3)

comment:1 Changed 14 months ago by mr.schyte

Hi! I've hit the same bug with intero. If I try calling a function from the emacs repl I receive the panic message, but the same call works fine from the terminal.

ghc: panic! (the 'impossible' happened)
  (GHC version 8.4.3 for x86_64-unknown-linux):
	nameModule
  system $dShow_a4FZ
  Call stack:
      CallStack (from HasCallStack):
        callStackDoc, called at compiler/utils/Outputable.hs:1150:37 in ghc:Outputable
        pprPanic, called at compiler/basicTypes/Name.hs:241:3 in ghc:Name

Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug

This is the program I'm using; I'm trying to call "readBlock s 10", which fails. I can call both blockPath and print blocks using show without errors.

module Lib
  where

import Control.Exception (try, catch, IOException)
import qualified Data.ByteString as B
import System.FilePath
import Text.Printf (printf)

data Block = Block {
  offset :: Int, -- Padding length at the front
  bytes :: B.ByteString -- The contents of the block
} deriving Show

data Store = Store {
  dirs :: [FilePath],
  bsize :: Int,
  count :: Int
}

s = Store ["/tmp/1", "/tmp/2"] 10 10 

blockPath :: Store -> Int -> FilePath
blockPath (Store d _ _) i = dir </> (printf "%016x.dat" i)
  where
    dir = d !! (mod i (length d))

readBlock :: Store -> Int -> IO (Block)
readBlock s i = catch (B.readFile path >>= (return . (Block i))) handler
  where
    handler :: IOException -> IO (Block)
    handler _ = return $ Block 0 (B.replicate (bsize s) 0)
    path = blockPath s i

comment:2 Changed 14 months ago by bgamari

Milestone: 8.6.18.8.1

These won't be fixed for in GHC 8.6.

comment:3 Changed 13 months ago by kabuhr

Resolution: duplicate
Status: newclosed

This looks like a duplicate of #14963. I've confirmed that commit Phab:rGHC4a931665e41b fixes the test case given in comment:1. I wasn't able to directly confirm that it fixes the originally reported issue, but that issue matches the pattern described in trac:14963:comment:8 which should be fixed by this commit, too.

Note: See TracTickets for help on using tickets.