[GHC] #8116: Segfault/panic of 32bit GHCi on Mac

#8116: Segfault/panic of 32bit GHCi on Mac ------------------------------------+------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Keywords: | Operating System: MacOS X Architecture: Unknown/Multiple | Type of failure: GHCi crash Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------- 32bit GHCi on Mac causes segfault/panic: With GHC 7.6.3: {{{
:m Data.Complex [Prelude Data.Complex] ((-2) :+ 0)**(1.5 :+ 0) zsh: segmentation fault ghci }}}
:m Data.Complex ((-2) :+ 0)**(1.5 :+ 0) ghc: panic! (the 'impossible' happened) (GHC version 7.7.20130805 for i386-apple-darwin): Loading temp shared object failed:
With GHC head: {{{ dlopen(/var/folders/k0/548g5xg90jjfbrj5j09nvwv80000gq/T/ghc124_0/ghc124_0.dylib, 9): Library not loaded: /Users/kazu/work/ghc/libraries/base/dist- install/build/libHSbase-4.7.0.0-ghc7.7.20130805.dylib Referenced from: /var/folders/k0/548g5xg90jjfbrj5j09nvwv80000gq/T/ghc124_0/ghc124_0.dylib Reason: image not found Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} 64bit GHCi does not cause this problem. Any GHCi on Linux and FreeBSD do not cause this problem. If the code is compiled with 32bit GHC on Mac, it works fine. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by shelarcy): Second bug is caused by DYNAMIC_GHC_PROGRAMS on Mac OS X platform. I reproduced that on 64 bit GHCi, if DYNAMIC_GHC_PROGRAMS = Yes when building GHC HEAD. {{{ $ ghc --info [("Project name","The Glorious Glasgow Haskell Compilation System") (snip) ,("Project version","7.7.20130810") ,("Booter version","7.6.3") ,("Stage","2") ,("Build platform","x86_64-apple-darwin") ,("Host platform","x86_64-apple-darwin") ,("Target platform","x86_64-apple-darwin") (snip) ,("Support dynamic-too","YES") ,("Dynamic by default","NO") ,("GHC Dynamic","YES") ,("Leading underscore","YES") ,("Debug on","False") ,("LibDir","/Library/Frameworks/GHC.framework/Versions/7.7.20130810-x86_64/usr/lib/ghc-7.7.20130810") ,("Global Package DB","/Library/Frameworks/GHC.framework/Versions/7.7.20130810-x86_64/usr/lib/ghc-7.7.20130810/package.conf.d") ] }}} {{{ Prelude Data.Complex> ((-2) :+ 0)**(1.5 :+ 0) ghc: panic! (the 'impossible' happened) (GHC version 7.7.20130810 for x86_64-apple-darwin): Loading temp shared object failed: dlopen(/var/folders/zs/bsr11y_x3d76ssg4bl_kx7nm0000gn/T/ghc74358_0/ghc74358_0.dylib, 9): Library not loaded: /Users/shelarcy/Desktop/ghc/libraries/base/dist- install/build/libHSbase-4.7.0.0-ghc7.7.20130810.dylib Referenced from: /var/folders/zs/bsr11y_x3d76ssg4bl_kx7nm0000gn/T/ghc74358_0/ghc74358_0.dylib Reason: image not found Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug }}} If DYNAMIC_GHC_PROGRAMS = NO when building GHC, 64 bit GHCi work fine. build.mk {{{ DYNAMIC_GHC_PROGRAMS = NO }}} {{{ $ ghc --info [("Project name","The Glorious Glasgow Haskell Compilation System") (snip) ,("Project version","7.7.20130810") ,("Booter version","7.6.3") ,("Stage","2") ,("Build platform","x86_64-apple-darwin") ,("Host platform","x86_64-apple-darwin") ,("Target platform","x86_64-apple-darwin") (snip) ,("Support dynamic-too","YES") ,("Dynamic by default","NO") ,("GHC Dynamic","NO") ,("Leading underscore","YES") ,("Debug on","False") ,("LibDir","/Library/Frameworks/GHC.framework/Versions/7.7.20130810-x86_64/usr/lib/ghc-7.7.20130810") ,("Global Package DB","/Library/Frameworks/GHC.framework/Versions/7.7.20130810-x86_64/usr/lib/ghc-7.7.20130810/package.conf.d") ] }}} {{{ Prelude Data.Complex> ((-2) :+ 0)**(1.5 :+ 0) (-5.195736337412959e-16) :+ (-2.82842712474619) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by bkomuves): More data points: 32 bit GHC 7.4.2 (from the Haskell Platform) on OSX 10.8.4: {{{ Prelude> :m + Data.Complex Prelude Data.Complex> ((-2) :+ 0)**(1.5 :+ 0) Segmentation fault: 11 }}} Also: {{{ one, two :: Complex Double one = 1/(1-exp(pi*1/3*(0:+1))/2) -- this works two = 1/(1-exp(pi*2/3*(0:+1))/2) -- this segfaults }}} ghci segfaults, runghc silently exits (after a long wait), compiled it works (with any optimization level). However, with {{{ one, two :: Complex Float }}} instead, it works (the original example above works, too, when annotated to be `Complex Float`) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by kazu-yamamoto): It seems to me that 3e598fe0b01f4692f50c377ac91010040227e7ce of GHC head fixed this bug, too. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by gmainland): I'm surprised 3e598fe0b01f4692f50c377ac91010040227e7ce fixed this bug because my patch fixed an x86-32 calling convention bug that I introduced after 7.6 was barnched, so we certainly shouldn't have seen the bug in this ticket in code produced by 7.4.2! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by kazu-yamamoto): GHC 7.6.3 got segfault while GHC head got panic. Probably the source of two bugs are different. 3e598fe0b01f4692f50c377ac91010040227e7ce fixed the latter, I guess. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by shelarcy): Replying to [comment:1 shelarcy]:
Second bug is caused by DYNAMIC_GHC_PROGRAMS on Mac OS X platform. I reproduced that on 64 bit GHCi, if DYNAMIC_GHC_PROGRAMS = Yes when building GHC HEAD.
It seems that 64 bit GHCi's problem is also fixed in HEAD, now. HEAD's 64 bit GHCi works fine, if DYNAMIC_GHC_PROGRAMS = Yes. {{{ $ ghc --info [("Project name","The Glorious Glasgow Haskell Compilation System") (snip) ,("Project version","7.7.20130814") ,("Booter version","7.6.3") ,("Stage","2") ,("Build platform","x86_64-apple-darwin") ,("Host platform","x86_64-apple-darwin") ,("Target platform","x86_64-apple-darwin") (snip) ,("Support dynamic-too","YES") ,("Dynamic by default","NO") ,("GHC Dynamic","YES") ,("Leading underscore","YES") ,("Debug on","False") ,("LibDir","/Library/Frameworks/GHC.framework/Versions/7.7.20130814-x86_64/usr/lib/ghc-7.7.20130814") ,("Global Package DB","/Library/Frameworks/GHC.framework/Versions/7.7.20130814-x86_64/usr/lib/ghc-7.7.20130814/package.conf.d") ] }}} {{{ Prelude Data.Complex> ((-2) :+ 0)**(1.5 :+ 0) (-5.195736337412959e-16) :+ (-2.82842712474619) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Comment (by kazu-yamamoto): It seems to me that we will not have GHC 7.6.4 to fix this problem. GHC 7.8.1 will be released with this bug fixed. So, let's close this ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ----------------------------------+------------------------------------ Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: Unknown/Multiple Type of failure: GHCi crash | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: ----------------------------------+------------------------------------ Changes (by kazu-yamamoto): * status: new => closed * resolution: => fixed -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac
----------------------------------+------------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: fixed | Keywords:
Operating System: MacOS X | Architecture: Unknown/Multiple
Type of failure: GHCi crash | Difficulty: Unknown
Test Case: | Blocked By:
Blocking: | Related Tickets:
----------------------------------+------------------------------------
Comment (by Austin Seipp

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by thoughtpolice): * testcase: => ghci/scripts/T8116 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac
---------------------------------------+-----------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: MacOS X | Architecture:
Type of failure: GHCi crash | Unknown/Multiple
Test Case: ghci/scripts/T8116 | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
---------------------------------------+-----------------------------------
Changes (by jstolarek):
* status: closed => new
* resolution: fixed =>
Comment:
Austin, I'm afraid this test fails on 32 bit Linux:
{{{
$ make TEST=T8116 WAY=ghci
...
=====> T8116(ghci) 2388 of 3755 [0, 0, 0]
cd ./ghci/scripts && HC='/5playpen/t-jastol/ghc-validate/inplace/bin/ghc-
stage2' HC_OPTS='-dcore-lint -dcmm-lint -dno-debug-output -no-user-
package-db -rtsopts -fno-ghci-history ' '/5playpen/t-jastol/ghc-
validate/inplace/bin/ghc-stage2' --interactive -v0 -ignore-dot-ghci
-dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts
-fno-ghci-history

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by gmainland): Well it certainly no longer segfaults, which was the original bug. Floating point inaccuracy is a different kind of failure, so it should probably be a new bug report. Is this failure occurring on HEAD? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by kazu-yamamoto): I cannot reproduce this on my 32bit Linux: {{{ % ghci GHCi, version 7.7.20130813: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. Prelude> :m Data.Complex Prelude Data.Complex> ((-2) :+ 0)**(1.5 :+ 0) (-5.195564742431613e-16) :+ (-2.82842712474619) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by jstolarek):
it should probably be a new bug report I'm not sure if tweaking a newly created test is worth an extra bug report.
Is this failure occurring on HEAD? Yes. I wouldn't report it otherwise.
I cannot reproduce this on my 32bit Linux: I assume that the test passes also when you run it with `make TEST=T8116 WAY=ghci` in testsuite/tests? I'm not really surprised. Floating-point comparisons are very unreliable, so testing for equality of floats is a risky thing to do.
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by thoughtpolice): Bah, I figured this might happen but was hoping we'd be OK on the accuracy in this case. Maybe it was too late... Thinking about it more, the test isn't really checking output, it just wants to check the actual floating point code works. Since Complex is already strict in both of its components, a better test might be something like: {{{ :set -XBangPatterns :m + Data.Complex let !x = ... in putStrLn "BOOM" }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac
---------------------------------------+-----------------------------------
Reporter: kazu-yamamoto | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords:
Operating System: MacOS X | Architecture:
Type of failure: GHCi crash | Unknown/Multiple
Test Case: ghci/scripts/T8116 | Difficulty: Unknown
Blocking: | Blocked By:
| Related Tickets:
---------------------------------------+-----------------------------------
Comment (by Austin Seipp

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Comment (by ezyang): Jan, would you consider this bug fixed? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#8116: Segfault/panic of 32bit GHCi on Mac ---------------------------------------+----------------------------------- Reporter: kazu-yamamoto | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 7.6.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: Type of failure: GHCi crash | Unknown/Multiple Test Case: ghci/scripts/T8116 | Difficulty: Unknown Blocking: | Blocked By: | Related Tickets: ---------------------------------------+----------------------------------- Changes (by thoughtpolice): * status: new => closed * resolution: => fixed Comment: We discussed it shortly on IRC the other week when I made the change, and I think this is fine to close now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8116#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC