[GHC] #14535: ghc: panic! (the 'impossible' happened) (GHC version 8.2.1 for x86_64-apple-darwin): stack depth overflow

GHC ghc-devs at haskell.org
Mon Nov 27 23:29:03 UTC 2017


#14535: ghc: panic! (the 'impossible' happened)   (GHC version 8.2.1 for x86_64
-apple-darwin):  stack depth overflow
-------------------------------------+-------------------------------------
           Reporter:  iTotallyExist  |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  high           |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:  panic! stack   |  Operating System:  MacOS X
  depth overflow                     |
       Architecture:                 |   Type of failure:  GHCi crash
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 I created a neural network library within haskell.  I was able to create,
 test, and train the net (using data from the mNist dataset).  I could only
 test manually (try one input at a time and compare the two outputs), so i
 made a function which allowed me to test many test inputs on the net at
 once.

 Recreating bug:
 first, load main.hs in ghci (duh)
 then, run the entirety of trainedNetwork.txt as a command to initialise
 the network (i.e. copy paste the file into the ghci command line)
 then run the entirety of test.txt as a command. Here you will get the
 error.
 To test with different input values for the function "test" (the function
 whose being run caused the crash), you can open the jupyter notebook and
 run the function mnistTest with higher or lower values (higher using more
 test cases, lower using less) and run the output of that function as a
 command in haskell. (i know from testing that 30 inputs does not cause a
 crash, but 50 does).

 What i know is not the problem/probably causes:
 I know that y was initiliased correctly.
 The function being run here is :
 {{{#!hs
 --takes in a network and an array of test inputs and their corresponding
 outputs and returns the accuracy of the network
 --only works for classification networks
 testClassification :: [Layer] -> [[Double]] -> [[Double]] -> Double
 testClassification net inputs outputs = testClassificationHelper net
 inputs outputs 0 0

 testClassificationHelper :: [Layer] -> [[Double]] -> [[Double]] -> Double
 -> Double -> Double
 testClassificationHelper _ [] _ correct incorrect =
 (correct/(correct+incorrect))
 testClassificationHelper net (input:inputs) (output:outputs) correct
 incorrect | netMax == outMax = next (correct+1) incorrect
 | otherwise = next correct (incorrect+1)
 where
 next = testClassificationHelper net inputs outputs
 netMax = greatestIndex (getOutput net input)
 outMax = greatestIndex output
 }}}
 I know that getOutput and greatestIndex work\\
 I know that it works with a small amount of inputs (test3.txt is
 essentially the same command except instead of using the first 100 test
 examples of the mnist data set, it uses the first 3)\\
 I know that it works when using the first 30 data points, but not with the
 first 50.\\
 I know that doing it for the first 30 inputs only takes 2 seconds and 270
 MB, while training the network took 40 minutes and 820GB, take from that
 what you will\\

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


More information about the ghc-tickets mailing list