Skip to content

Intermittent segfault when using ghc-7.6.3 -e on OSX 10.6.8

This error was observed using the 64-bit version of ghc-7.6.3 packaged with the Haskell Platform 2013.2.0.0 for OSX.

Running commands with ghc -e sometimes produces a segfault.

% ghc -e 'return ()' ; echo $?
0
% ghc -e 'return ()' ; echo $?
zsh: segmentation fault  ghc -e 'return ()'
139

I don't know exactly what's causing it, but I'm suspicious of the binary distributed with the package. When I pull it up in gdb, there are warnings pertaining to missing object files expected to be in a /Users/ian directory. There's never been an ian user on my machine, so I suspect that's an artifact from whomever built the binary. This may also be the root of the intermittent segfault

% cd /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3
% gdb ghc
GNU gdb 6.3.50-20050815 (Apple version gdb-1518) (Sat Feb 12 02:52:12 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries .... done

warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(darwin64.o)" - no debug information available for "/var/folders/9z/yntzqjqn1j95xbpb6dr3qbww0000gn/T//ccr2b8iU.s".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(ffi64.o)" - no debug information available for "../src/x86/ffi64.c".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(prep_cif.o)" - no debug information available for "../src/prep_cif.c".


warning: Could not find object file "/Users/ian/zz64/ghc-7.6.3/rts/dist/build/libHSrts_thr.a(types.o)" - no debug information available for "../src/types.c".


(gdb) run -B. -e 'return ()'
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e 'return ()'
Reading symbols for shared libraries + done

Program exited normally.
(gdb) run -B. -e 'return ()'
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e 'return ()'
Reading symbols for shared libraries + done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000f34ed440
0x00000001f34d659a in evacuate1 ()
(gdb) where
#0  0x00000001f34d659a in evacuate1 ()
#1  0x00000001f34dc1b8 in scavenge_block1 ()
Previous frame inner to this frame (gdb could not unwind past this frame)
(gdb) kill
Kill the program being debugged? (y or n) y
error while killing target (killing anyway): assertion failure on line 300 of "/SourceCache/gdb/gdb-1518/src/gdb/macosx/macosx-nat-inferior-util.c" in function "macosx_inferior_suspend_ptrace": status.value.sig == TARGET_SIGNAL_STOP

warning: error on line 2182 of "/SourceCache/gdb/gdb-1518/src/gdb/macosx/macosx-nat-inferior.c" in function "macosx_kill_inferior_safe": (os/kern) failure (0x5x)
(gdb) run -B. -e '()'
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e '()'
Reading symbols for shared libraries + done
()

Program exited normally.
(gdb) run -B. -e '()'
Starting program: /Library/Frameworks/GHC.framework/Versions/7.6.3-x86_64/usr/lib/ghc-7.6.3/ghc -B. -e '()'
Reading symbols for shared libraries + done

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000000d1916440
[Switching to process 18462 thread 0x2003]
0x00000001d191bc44 in stg_ap_v_fast ()
(gdb) where
#0  0x00000001d191bc44 in stg_ap_v_fast ()
#1  0x0000000000000000 in ?? ()
(gdb)
Trac metadata
Trac field Value
Version 7.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information