Ticket #2554 (closed bug: fixed)

Opened 5 years ago

Last modified 5 years ago

internal error: stg_ap_pp_ret (with terminfo)

Reported by: judah Owned by: simonmar
Priority: high Milestone: 6.10.1
Component: Compiler Version: 6.9
Keywords: Cc:
Operating System: MacOS X Architecture: x86
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

When trying to run the haskeline package against HEAD, I sometimes get bus errors, segfaults or the following error:

Test: internal error: stg_ap_pp_ret
    (GHC version 6.9.20080827 for i386_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Abort trap

I've tried to strip down the relevant parts of the code. Attached is my best attempt to isolate the error. The code runs fine on 6.8.3, but crashes with a segfault or bus error if it was compiled with ghc-6.9.20080827:

$ ~/tmp/ghc-stage/bin/ghc --make -threaded Test.hs -fforce-recomp -lncurses
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Linking Test ...
$ ./Test 
foobar1
Starting loop...
About to do the bad thing.
Segmentation fault

This is with OS X 10.5.4.

Attachments

Test.hs Download (0.6 KB) - added by judah 5 years ago.
Test code to reproduce the error.
c_test.c Download (129 bytes) - added by judah 5 years ago.
C code which should be linked against Test.hs.
Test2.hs Download (0.9 KB) - added by judah 5 years ago.
Alternate file to reproduce the error

Change History

Changed 5 years ago by judah

I managed to strip down the test case to eliminate the dependency on the curses library. Hopefully this isolates the problem a little better. See the attached Test.hs and c_test.c.

$ ~/tmp/ghc-stage/bin/ghc --make -fforce-recomp -threaded Test.hs c_test.c
[1 of 1] Compiling Main             ( Test.hs, Test.o )
Linking Test ...

$ ./Test
Calling function.
Called function.
Calling function.
Test: internal error: stg_ap_pp_ret
    (GHC version 6.9.20080827 for i386_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Abort trap

Changed 5 years ago by judah

Test code to reproduce the error.

Changed 5 years ago by judah

C code which should be linked against Test.hs.

Changed 5 years ago by igloo

  • difficulty set to Unknown
  • milestone set to 6.10.1

Thanks for the testcase. However, I'm unable to reproduce the problem with 6.9.20080828. I've run Test 20 or 30 times, and I just get

$ ./Test 
Calling function.
Called function.
Calling function.
Called function.

Changed 5 years ago by judah

Alternate file to reproduce the error

Changed 5 years ago by judah

It might be easier to reproduce the error with Test2.hs (attached) instead of Test.hs. Pressing ctrl-c when it prompts the user to enter a character causes a crash on my machine:

$ ./Test2 
Calling function.
Called function.
Enter a character, or press ctrl-c.
^CResult:Nothing
Calling function.
Bus error

Changed 5 years ago by igloo

After speaking to judah online, I tried with a quickest build, and my fourth attempt (with the original Test.hs) gave me:

$ ./Test 
Calling function.
Called function.
Calling function.
Test: internal error: stg_ap_pp_ret
    (GHC version 6.9.20080830 for i386_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Abort trap

Changed 5 years ago by igloo

And Test2 consistently gives me:

$ ./Test2 
Calling function.
Called function.
Enter a character, or press ctrl-c.
^CResult:Nothing
Calling function.
Test2: internal error: stg_ap_pp_ret
    (GHC version 6.9.20080830 for i386_apple_darwin)
    Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
Abort trap

Changed 5 years ago by judah

FWIW, building HEAD with BuildFlavor=perf made the error unreproducible for me too.

Changed 5 years ago by simonmar

  • owner set to simonmar
  • priority changed from normal to high

So you need a "quickest" build, i.e. no library optimisation?

Changed 5 years ago by igloo

quickest in the sense of mk/build.mk.sample, yes.

Changed 5 years ago by simonmar

  • status changed from new to closed
  • resolution set to fixed

Fixed:

Tue Sep  2 13:45:04 BST 2008  Simon Marlow <marlowsd@gmail.com>
  * FIX #2554: GHC.TopHandler.{runIO,runNonIO} should be GC roots
Note: See TracTickets for help on using tickets.