[GHC] #13527: ghc has a stack space leak when prints warnings

GHC ghc-devs at haskell.org
Tue Apr 4 22:08:19 UTC 2017


#13527: ghc has a stack space leak when prints warnings
-------------------------------------+-------------------------------------
           Reporter:  slyfox         |             Owner:  (none)
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.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:
-------------------------------------+-------------------------------------
 Found on a crash when ghc tried to print a warning in a huge assembly
 file.

 I've simplified it to autogenerated C file with an error:
 {{{
 # generate 10 million lines file
 # and put an error into the very end of file
 $ { for i in `seq 1 $((10 * 1000 * 1000))`; do echo "// a comment number
 $i"; done; echo 'static int foo = ;'; } > a.c
 }}}

 {{{
 $ LANG=C powerpc64le-unknown-linux-gnu-ghc -c a.c +RTS -K128M

 stack overflow: use +RTS -K<size> to increase it
 }}}

 C compiler tried to output something like the following to stderr:
 {{{
 a.c:10000001:0: error:
      error: expected expression before ';' token
      static int foo = ;
 }}}

 GHC finds 'a.c:10000001' location and tries to pretty-print the line.
 We get a space leak somewhere.

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


More information about the ghc-tickets mailing list