#7539: Hard ghc api crash when calling runStmt on code which has not been 
Reporter:  edsko             |          Owner:                  
    Type:  bug               |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  7.6.1             |       Keywords:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
 Failure:  None/Unknown      |      Blockedby:                  
Blocking:                    |        Related:                  
 (See attached example program demonstrating the crash.) When the session
 flags are set to

   let flags = flags0 { hscTarget = HscNothing, ghcLink = NoLink } --

 and we later try to run the code (`runStmt`), the GHC API crashes. If
 instead we set the flags to

   let flags = flags0 { hscTarget = HscNothing, ghcLink = LinkBinary } --

 we get a nice error message instead:

 Undefined symbols for architecture i386:
   "_ZCMain_main_closure", referenced from:
       _main in ghc72975_0.o
 ld: symbol(s) not found for architecture i386
 collect2: ld returned 1 exit status
 TestGhc: TestGhc: phase `Linker' failed (exitcode = 1)

 The exact crash varies from run to run. Most often it is

 Bus error: 10

 Sometimes it is

 Segmentation fault: 11

 and in all my testing I've only once seen

 TestGhc: internal error: stg_ap_v_ret
     (GHC version 7.4.2 for i386_apple_darwin)
     Please report this as a GHC bug:
 Abort trap: 6

 (This is on a Mac, confirmed with both ghc 7.4 and ghc 7.6).

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

Glasgow-haskell-bugs mailing list

Reply via email to