#5837: Context reduction stack overflow can take very long
----------------------------------------+-----------------------------------
    Reporter:  dreixel                  |       Owner:  simonpj         
        Type:  bug                      |      Status:  new             
    Priority:  normal                   |   Milestone:  7.6.1           
   Component:  Compiler (Type checker)  |     Version:  7.4.1-rc2       
    Keywords:                           |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple         |     Failure:  None/Unknown    
  Difficulty:  Unknown                  |    Testcase:                  
   Blockedby:                           |    Blocking:                  
     Related:                           |  
----------------------------------------+-----------------------------------

Comment(by simonpj):

 OK, yes, this is much better. With HEAD:
 {{{
 simonpj@cam-05-unx:~/tmp$ ~/5builds/HEAD/inplace/bin/ghc-stage1 -c -ddump-
 cs-trace -fcontext-stack=5 T5837.hs
 1>[0] Top react: Fun/Top (given)
 2>[0] Top react: Fun/Top (given)
 3>[1] Top react: Fun/Top (given)
 4>[0] Top react: Fun/Top (given)
 5>[1] Top react: Fun/Top (given)
 6>[2] Top react: Fun/Top (given)
 7>[0] Top react: Fun/Top (given)
 8>[1] Top react: Fun/Top (given)
 9>[2] Top react: Fun/Top (given)
 10>[3] Top react: Fun/Top (given)
 11>[0] Top react: Fun/Top (given)
 12>[1] Top react: Fun/Top (given)
 13>[2] Top react: Fun/Top (given)
 14>[3] Top react: Fun/Top (given)
 15>[4] Top react: Fun/Top (given)
 16>[0] Top react: Fun/Top (given)
 17>[1] Top react: Fun/Top (given)
 18>[2] Top react: Fun/Top (given)
 19>[3] Top react: Fun/Top (given)
 20>[4] Top react: Fun/Top (given)
 21>[5] Top react: Fun/Top (given)

 T5837.hs:8:6:
     Context reduction stack overflow; size = 6
     Use -fcontext-stack=N to increase stack size to N
       cobox :: TF (TF (TF (TF (TF a))))
                ~ (TF (TF (TF (TF (TF (TF a))))), TF (TF (TF (TF (TF (TF
 Int))))))
 }}}
 Notice that the context stack is set to 5, but the trace goes
 {{{
   0
   0, 1
   0, 1, 2
   0, 1, 2, 3
   0, 1, 2, 3, 4
   etc
 }}}
 This quadratic behaviour is bad with a depth of 200!

 But with the new `ghc-new-flavor` branch we see
 {{{
 simonpj@cam-05-unx:~/tmp$  ~/5builds/ghc-solver/inplace/bin/ghc-stage1 -c
 -ddump-cs-trace -fcontext-stack=5 T5837.hs
 1>[0] Top react: Fun/Top
 2>[1] Top react: Fun/Top
 3>[2] Top react: Fun/Top
 4>[3] Top react: Fun/Top
 5>[4] Top react: Fun/Top
 6>[5] Top react: Fun/Top

 T5837.hs:8:6:
     Context reduction stack overflow; size = 6
     Use -fcontext-stack=N to increase stack size to N
       (TF (TF (TF (TF (TF (TF a))))), TF (TF (TF (TF (TF (TF Int))))))
       ~ TF (TF (TF (TF (TF a))))
 }}}
 Which is fine.

 But there is still something wrong!  If you try the above you'll see the
 output coming out fairly slowly.  And indeed adding `+RTS -s` and trying
 with different context stack sizes gives
 {{{
    -fcontext-stack=N      Bytes allocated
         100                  366M
         200                1,700M
         300                5,041M
 }}}
 Badly non-linear.  This is with a standard stage2 build, so no DEBUG flags
 on.

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to