[GHC] #13055: Adding INLINABLE pragma causes GHC panic

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.0.1 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: -------------------------------------+------------------------------------- If you add an `INLINABLE` pragma to `<**>` in `GHC.Base` then `stage2` fails to build with an `idInfo` panic. I don't really know where to begin debugging this but it seems quite bad! Here is a build where it fails: https://phabricator.haskell.org/harbormaster/build/17389/ Here is a branch with one commit with the change: https://github.com/ghc/ghc/tree/wip/inlinable-bug -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.0.1 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 rwbarton): The panic. I don't know what you mean with `idInfo`. It was trying to build `libraries/transformers/dist- install/build/Control/Applicative/Backwards.o`. {{{ ghc-stage1: panic! (the 'impossible' happened) (GHC version 8.1.20170102 for x86_64-unknown-linux): Iface Lint failure In interface for GHC.Base Unfolding of <**> <no location info>: warning: In the expression: $ @ a @ b Kinds don't match in type application: Type variable: r_1i :: RuntimeRep Arg type: a :: * xx * <no location info>: warning: In the expression: flip @ (a -> b) @ a @ b ($ @ a @ b) Argument value doesn't match argument type: Fun type: ((a -> b) -> a -> b) -> a -> (a -> b) -> b Arg type: forall (b :: TYPE a). (b -> b) -> b -> b Arg: $ @ a @ b <**> = \ (@ (f_a6mX :: * -> *)) (@ a_a6mY) (@ b_a6mZ) ($dApplicative_a6n0 :: Applicative f) -> liftA2 @ f @ a @ (a -> b) @ b $dApplicative_a6n0 (flip @ (a -> b) @ a @ b ($ @ a @ b)) Iface expr = \ @ f :: * -> * @ a @ b ($dApplicative :: Applicative f) -> liftA2 @ f @ a @ (a -> b) @ b $dApplicative (flip @ (a -> b) @ a @ b ($ @ a @ b)) }}} I'm not sure where `$ @ a @ b` came from but it seems to be treating `a` as the kind/representation argument when clearly it was intended to be the `a` in `(a -> b) -> a -> b`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.0.1 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): Oh I see. That is more useful. I don't think my build locally was running the Iface Lint and so the panic was coming from somewhere different. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: new Priority: high | Milestone: Component: Compiler | Version: 8.0.1 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 rwbarton): Ah I see. What does `./inplace/bin/ghc-stage2 --show-iface ./libraries/base/dist-install/build/GHC/Base.hi` have to say about `<**>`, for you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13055: Adding INLINABLE pragma causes GHC panic
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 8.0.1
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 rwbarton):
Oh never mind, the unfolding is in the panic.
In a normal build, I have this unfolding information
{{{
e8b07c72a9d4975f2b942de3da1a768e
(<**>) :: Applicative f => f a -> f (a -> b) -> f b
{- Arity: 3, HasNoCafRefs,
Strictness:

#13055: Adding INLINABLE pragma causes GHC panic
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner:
Type: bug | Status: new
Priority: high | Milestone:
Component: Compiler | Version: 8.0.1
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 Ben Gamari

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | 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: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => fixed * milestone: => 8.2.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13055: Adding INLINABLE pragma causes GHC panic -------------------------------------+------------------------------------- Reporter: mpickering | Owner: Type: bug | Status: closed Priority: high | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: fixed | 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): I'm very confused about this. The comment at the top of `GHC.Base` says {{{ NOTA BENE: Do NOT use ($) anywhere in this module! The type of ($) is slightly magical (it can return unlifted types), and it is wired in. But, it is also *defined* in this module, with a non-magical type. GHC gets terribly confused (and *hangs*) if you try to use ($) in this module, because it has different types in different scenarios. This is not a problem in general, because the type ($), being wired in, is not written out to the interface file, so importing files don't get confused. The problem is only if ($) is used here. So don't! }}} (It should jolly well have a `Note` heading so we can refer to it.) But I don't understand that. The wired-in definition should override the local one, even in the module it is defined in. I'd love a better understanding of what goes wrong. But life is short, I suppose. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13055#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC