[GHC] #7820: Installing profiling library BREAKS non-profiling executable

#7820: Installing profiling library BREAKS non-profiling executable --------------------------+------------------------------------------------- Reporter: rrnewton | Owner: Type: bug | Status: new Priority: normal | Component: Compiler Version: 7.6.2 | Keywords: profiling Os: Linux | Architecture: x86_64 (amd64) Failure: Runtime crash | Blockedby: Blocking: | Related: --------------------------+------------------------------------------------- I am trying to work through problems with different GHC "ways" so that I can broadly deploy a library of foreign primops for lockfree data structures. Here's the package I am testing at the moment: https://github.com/rrnewton/haskell-lockfree- queue/tree/5d990fe43a983fc5ed32c3f58cb2e59df71b00b6/AtomicPrimops Here is a recipe for reproducing the bug from within that directory. Both of these build modes work FINE: (cabal install --enable-library-profiling; cd testing; make prof; ./Test_prof.exe) (cabal install --disable-library-profiling; cd testing; make; ./Test_threaded.exe) That is, building both library and executable with profiling, or without profiling, works fine. But then this creates an executable that segfaults: (cabal install --enable-library-profiling; cd testing; make; ./Test_threaded.exe) At runtime the call to the .cmm-defined foreign primop just returns zero, and then the process segfaults when it tries to use that as a Haskell value. But my understanding is that --enable-library-profiling should just add extra binaries to .cabal and NOT change the behavior of the non-profiling binaries. Yet I can confirm that I see slightly different binary sizes with the non- profiling .o and .a files installed in ~/.cabal/lib depending on whether --enable-library-profiling is activated. Perhaps this in itself is a cabal bug, but I haven't tracked down exactly what the difference is yet. I have confirmed the above behavior under: * Mac OS (ghc 7.4.2 and 7.6.2) * Linux, RHEL 6 (ghc 7.4.2 and 7.6.2) -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7820 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7820: Installing profiling library BREAKS non-profiling executable -------------------------------+-------------------------------------------- Reporter: rrnewton | Owner: igloo Type: bug | Status: new Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.2 Keywords: profiling | Os: Linux Architecture: x86_64 (amd64) | Failure: Runtime crash Difficulty: Unknown | Testcase: Blockedby: | Blocking: Related: | -------------------------------+-------------------------------------------- Changes (by igloo): * owner: => igloo * difficulty: => Unknown * milestone: => 7.8.1 Comment: Thanks for the report. This sounds very strange. I'll see if I can reproduce it. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7820#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7820: Installing profiling library BREAKS non-profiling executable ----------------------------+----------------------------------------------- Reporter: rrnewton | Owner: igloo Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.2 Resolution: invalid | Keywords: profiling Os: Linux | Architecture: x86_64 (amd64) Failure: Runtime crash | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ----------------------------+----------------------------------------------- Changes (by igloo): * status: new => closed * resolution: => invalid Comment: Aha, if you look at the `-v` output of `cabal-install`, then you can see that it only builds `cbits/primops.cmm` once (rather than separately for each way), and with profiling enabled it's compiled with `-prof`. This presumably means that some structure is the wrong size for teh vanilla way, leading to a segfault. So this looks like a bug in Cabal rather than GHC. Please file a ticket in [https://github.com/haskell/cabal/issues Cabal's BTS]. -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7820#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#7820: Installing profiling library BREAKS non-profiling executable ----------------------------+----------------------------------------------- Reporter: rrnewton | Owner: igloo Type: bug | Status: closed Priority: normal | Milestone: 7.8.1 Component: Compiler | Version: 7.6.2 Resolution: invalid | Keywords: profiling Os: Linux | Architecture: x86_64 (amd64) Failure: Runtime crash | Difficulty: Unknown Testcase: | Blockedby: Blocking: | Related: ----------------------------+----------------------------------------------- Comment(by rrnewton): Thanks! Note, this is now filed as cabal issue 1284: https://github.com/haskell/cabal/issues/1284 -- Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/7820#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC