[GHC] #16348: GHC HEAD regression: tyConAppArgs

GHC ghc-devs at haskell.org
Wed Feb 20 19:54:40 UTC 2019


#16348: GHC HEAD regression: tyConAppArgs
-------------------------------------+-------------------------------------
           Reporter:  RyanGlScott    |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.7
           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:
-------------------------------------+-------------------------------------
 The following program compiles (with `-O`) on GHC 7.0.4 through 8.6.3, but
 panics on HEAD:

 {{{#!hs
 {-# LANGUAGE DeriveFunctor #-}
 module Bug where

 data V2 a = V2 !a !a deriving Functor

 (*^) :: (Functor f, Num a) => a -> f a -> f a
 (*^) a = fmap (a*)

 (*!!) :: (Functor m, Functor r, Num a) => a -> m (r a) -> m (r a)
 s *!! m = fmap (s *^) m

 type M22 a = V2 (V2 a)

 det22 :: Num a => M22 a -> a
 det22 (V2 (V2 a b) (V2 c d)) = a * d - b * c

 inv22 :: Fractional a => M22 a -> M22 a
 inv22 m@(V2 (V2 a b) (V2 c d)) = (1 / det) *!! V2 (V2 d (-b)) (V2 (-c) a)
   where det = det22 m
 }}}
 {{{
 $ ~/Software/ghc4/inplace/bin/ghc-stage2 -fforce-recomp Bug.hs -O
 [1 of 1] Compiling Bug              ( Bug.hs, Bug.o )
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 8.7.20190219 for x86_64-unknown-linux):
         tyConAppArgs
   a_a1FK
   Call stack:
       CallStack (from HasCallStack):
         callStackDoc, called at compiler/utils/Outputable.hs:1159:37 in
 ghc:Outputable
         pprPanic, called at compiler/types/Type.hs:1183:50 in ghc:Type
 }}}

 Note that this panic does not occur if `V2` is defined without `!`s.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16348>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list