Quantcast

[GHC] #13710: panic with boot and -jX

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GHC] #13710: panic with boot and -jX

GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
           Reporter:  pacak          |             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:  Compile-time
  Unknown/Multiple                   |  crash or panic
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{
 % cat A.hs
 module A where
 }}}

 {{{
 % cat A.hs-boot
 module A ( A ) where

 type A = Maybe ()

 yay :: A -> IO ()
 }}}

 {{{
 % cat B.hs
 module B where

 import {-# SOURCE #-} A
 }}}

 This panics:
 {{{
 % rm -rf o ; ghc -j2 -outputdir o B
 [1 of 3] Compiling A[boot]          ( A.hs-boot, o/A.o-boot )
 [2 of 3] Compiling A                ( A.hs, o/A.o )

 <no location info>: error:
     ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.0.20170503 for x86_64-unknown-linux):
         tcIfaceGlobal (local): not found
   You are in a maze of twisty little passages, all alike.
   While forcing the thunk for TyThing A
   which was lazily initialized by initIfaceCheck typecheckLoop,
   I tried to tie the knot, but I couldn't find A
   in the current type environment.
   If you are developing GHC, please read Note [Tying the knot]
   and Note [Type-checking inside the knot].
   Consider rebuilding GHC with profiling for a better stack trace.
   Contents of current type environment:
     [r15J :-> Identifier ‘$trModule’]
   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/iface/TcIface.hs:1689:23 in
 ghc:TcIface

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


 This works:
 {{{
 % rm -rf o ; ghc -j1 -outputdir o B
 [1 of 3] Compiling A[boot]          ( A.hs-boot, o/A.o-boot )
 [2 of 3] Compiling A                ( A.hs, o/A.o )

 A.hs-boot:3:1: error:
     ‘A.A’ is exported by the hs-boot file, but not exported by the module
   |
 3 | type A = Maybe ()
   | ^^^^^^^^^^^^^^^^^
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      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 pacak):

 works as expected in 8.0

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      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:                    |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: ezyang (added)


Comment:

 I think this is Edward's error message.

 Edward might you look?

 Simon

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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:                    |
-------------------------------------+-------------------------------------
Changes (by ezyang):

 * keywords:   => hs-boot


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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 ezyang):

 This bug is kind of similar to #12063, in that the panic is induced when
 we attempt to use interfaces prior to having checked that everything is
 squared away. The interface usage is probably related to parallel mode.
 I'll take a look.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 pacak):

 It might be slightly different from the bug you mentioned - it was
 minimized from code that compiles fine with 8.0 and panics with r 2, but
 before minimization it wanted like a half of hackage to compile.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 pacak):

 In original code there's no effect from -j1 - it still panics.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 ezyang):

 So, I think this particular repro case may have been minimized too much.
 It's known that we have some bugs handling hs-boot typechecking when the
 typechecking would ultimately fail (as it would in this example, since the
 implementer doesn't implement enough), but if the original test case was
 code that "should" compile, then it would be better if we had a test case
 which similarly should compile.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 pacak):

 Panic in rc2, successfull compilation in 8.0 and 7.10

 {{{
 % cat A.hs
 {-# LANGUAGE RecordWildCards #-}

 module A where

 import B

 type E = ()

 yay :: Maybe ()
 yay = do
   H{..} <- undefined
   undefined
 }}}

 {{{
 % cat A.hs-boot
 module A ( E ) where
 type E = ()
 }}}

 {{{
 % cat B.hs
 module B where
 import {-# SOURCE #-} A
 data F a = F a
 type G = F (Maybe E)
 data H = H { h :: {-# UNPACK #-} !G }
 }}}


 rc2, -j1
 {{{
 % rm *.hi* *.o* ; ghc -j1 -O2 A.hs
 [1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
 [2 of 3] Compiling B                ( B.hs, B.o )
 [3 of 3] Compiling A                ( A.hs, A.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.0.20170503 for x86_64-unknown-linux):
         tcIfaceGlobal (local): not found
   You are in a maze of twisty little passages, all alike.
   While forcing the thunk for TyThing E
   which was lazily initialized by initIfaceCheck typecheckLoop,
   I tried to tie the knot, but I couldn't find E
   in the current type environment.
   If you are developing GHC, please read Note [Tying the knot]
   and Note [Type-checking inside the knot].
   Consider rebuilding GHC with profiling for a better stack trace.
   Contents of current type environment: []
   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/iface/TcIface.hs:1689:23 in
 ghc:TcIface

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


 rc2, -j2  - note - error message is slightly different + it's in color
 {{{
 % rm *.hi* *.o* ; ghc -j2 -O2 A.hs
 [1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
 [2 of 3] Compiling B                ( B.hs, B.o )
 [3 of 3] Compiling A                ( A.hs, A.o )

 <no location info>: error:
     ghc: panic! (the 'impossible' happened)
   (GHC version 8.2.0.20170503 for x86_64-unknown-linux):
         tcIfaceGlobal (local): not found
   You are in a maze of twisty little passages, all alike.
   While forcing the thunk for TyThing E
   which was lazily initialized by initIfaceCheck typecheckLoop,
   I tried to tie the knot, but I couldn't find E
   in the current type environment.
   If you are developing GHC, please read Note [Tying the knot]
   and Note [Type-checking inside the knot].
   Consider rebuilding GHC with profiling for a better stack trace.
   Contents of current type environment: []
   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/iface/TcIface.hs:1689:23 in
 ghc:TcIface

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

 ghc 8.0:
 {{{
 % rm *.hi* *.o* ; ghc -j1 -O2 A.hs
 [1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
 [2 of 3] Compiling B                ( B.hs, B.o )
 [3 of 3] Compiling A                ( A.hs, A.o )
 }}}

 {{{
 % rm *.hi* *.o* ; ghc -j2 -O2 A.hs
 [1 of 3] Compiling A[boot]          ( A.hs-boot, A.o-boot )
 [2 of 3] Compiling B                ( B.hs, B.o )
 [3 of 3] Compiling A                ( A.hs, A.o )
 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 ezyang):

 This is a record wild cards problem. Here is a further reduced test case:

 {{{
 -- A.hs
 {-# LANGUAGE RecordWildCards #-}
 module A where
 import B
 data E = MkE
 p (H{..}) = ()

 -- A.hs-boot
 module A ( E ) where
 data E

 -- B.hs
 module B where
 import {-# SOURCE #-} A
 data H = H { h :: E }
 }}}

 Probably what is happening is that record wildcards is forcing the thunk
 for E during renaming, which is far before it is ready. Workaround should
 be to replace the record wildcard with explicitly listed out fields.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 pacak):

 Workaround works on real code, thanks.

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 simonpj):

 Seems dangerously fragile to me.  Can you see a path to fixing it?

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #13710: panic with boot and -jX

GHC - devs mailing list
In reply to this post by GHC - devs mailing list
#13710: panic with boot and -jX
-------------------------------------+-------------------------------------
        Reporter:  pacak             |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.2.1-rc2
      Resolution:                    |             Keywords:  hs-boot
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 ezyang):

 So... apparently this patch fixes the problem, but I haven't quite figured
 out why.

 {{{
 diff --git a/compiler/iface/TcIface.hs b/compiler/iface/TcIface.hs
 index 3a6a4070d2..50fafcdadf 100644
 --- a/compiler/iface/TcIface.hs
 +++ b/compiler/iface/TcIface.hs
 @@ -908,7 +908,8 @@ tcIfaceDataCons tycon_name tycon tc_tybinders if_cons
          ; ~(eq_spec, theta, arg_tys, stricts) <- forkM (mk_doc dc_name) $
               do { eq_spec <- tcIfaceEqSpec spec
                  ; theta   <- tcIfaceCtxt ctxt
 -                ; arg_tys <- mapM tcIfaceType args
 +                ; arg_tys <- forkM (mk_doc dc_name <+> text "arg_tys")
 +                           $ mapM tcIfaceType args
                  ; stricts <- mapM tc_strict if_stricts
                          -- The IfBang field can mention
                          -- the type itself; hence inside forkM

 }}}

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

_______________________________________________
ghc-tickets mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-tickets
Loading...