[GHC] #13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11)

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.0.1 (LLVM) | Keywords: LLVM | Operating System: Linux Optimiser -11 | Architecture: arm | Type of failure: None/Unknown Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- While building [https://hackage.haskell.org/package/unicode-transforms] it fails with: {{{ cabal: Entering directory '/tmp/cabal-tmp-7667/unicode-transforms-0.2.0' Configuring unicode-transforms-0.2.0... Building unicode-transforms-0.2.0... Preprocessing library unicode-transforms-0.2.0... [ 1 of 12] Compiling Data.Unicode.Properties.DecompositionsK ( Data/Unicode/Properties/DecompositionsK.hs, dist/build/Data/Unicode/Properties/DecompositionsK.o ) [ 2 of 12] Compiling Data.Unicode.Properties.Decompositions ( Data/Unicode/Properties/Decompositions.hs, dist/build/Data/Unicode/Properties/Decompositions.o ) [ 3 of 12] Compiling Data.Unicode.Properties.DecomposableK ( Data/Unicode/Properties/DecomposableK.hs, dist/build/Data/Unicode/Properties/DecomposableK.o ) `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) cabal: Leaving directory '/tmp/cabal-tmp-7667/unicode-transforms-0.2.0' }}} Other details: {{{ $ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.0.1 $ opt --version LLVM (http://llvm.org/): LLVM version 3.7.1 Optimized build. Default target: armv7l-unknown-linux-gnueabihf Host CPU: (unknown) }}} I already submitted an issue to the package's bug tracker, but it is believed to be a GHC bug: [https://github.com/harendra-kumar/unicode- transforms/issues/10] -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by rwbarton): `opt` is the LLVM optimizer, not part of GHC. If it's exiting with exit code -11 that's almost certainly due to a segfault, which in turn is almost certainly due to it running out of memory, seeing as you're building on an ARM system and the source file contains a 72KB-long list literal. How much RAM does your build system have? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

`opt` is the LLVM optimizer, not part of GHC. If it's exiting with exit code -11 that's almost certainly due to a segfault, which in turn is almost certainly due to it running out of memory, seeing as you're building on an ARM system and the source file contains a 72KB-long list
#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by 2bdkid): Replying to [comment:1 rwbarton]: literal. How much RAM does your build system have? This is a Raspberry Pi 2 and it only has 1GB of ram. Is there any documentation for opt exit codes? I can't find any through Google -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by borsboom): I've hit the same problem with GHC 8.0.2. Building unicode- transforms-0.3.1 works with GHC 7.10.3 and LLVM 3.5.2, but has the "`opt' failed in phase `LLVM Optimiser'" error with GHC 8.0.2 and LLVM 3.7.1. This is on an emulated armv7 with 1 GB of RAM and 4 GB swap running Debian jessie. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): It sounds like it ran out of memory. What does `dmesg` say? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by borsboom): Nothing of interest in `dmesg`, and I just tried again while logging memory usage, and the system was nowhere near running out of memory (half the RAM was still being used for cache, and no swap usage) just before it terminated: {{{ $ free -m total used free shared buffers cached Mem: 1005 912 93 0 29 575 -/+ buffers/cache: 307 697 Swap: 3813 14 3799 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by bgamari): I'm not really sure what to say about this; given that it's `opt` crashing there is nothing to suggest that this is in fact an GHC bug. Can you reproduce this with GHC 8.2.1-rc3 and LLVM 3.9? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by borsboom): Gave it a try, but unfortunately the LLVM 3.9 bindists at http://releases.llvm.org/download.html#3.9.1 seem to be incompatible with my system and I can't risk breakage by upgrading it right now. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by harendra): Multiple data points suggest that it does not look like a memory issue. However, we could workaround the bug by splitting the long list. So it looks like `opt` cannot handle the code generated by GHC for a list that is too long. If someone knowledgable about the llvm/IR can pinpoint the issue or raise a bug with llvm upstream that will be helpful. This was working with an earlier version of GHC/LLVM so it is possible that this can be fixed easily. If it is non-trivial to fix for llvm/opt we can just close it and just avoid long lists. In that case, maybe GHC can issue a warning about long list so the the programmer can take appropriate action. In this particular case the list holds static data to initialize a bitmap, maybe this is just a rare use case for such a long list. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by George): I assume this bug is specific to ARM. Just in case it is of any value, it doesn't reproduce on my Mac with ghc 8.4.1 {{{ $ cabal install -f has-llvm unicode-transforms Resolving dependencies... Downloading bitarray-0.0.1.1... Configuring bitarray-0.0.1.1... Building bitarray-0.0.1.1... Installed bitarray-0.0.1.1 Downloading unicode-transforms-0.3.3... Configuring unicode-transforms-0.3.3... Building unicode-transforms-0.3.3... Installed unicode-transforms-0.3.3 Updating documentation index /Users/gcolpitts/Library/Haskell/share/doc/x86_64-osx-ghc-8.4.1/index.html }}} Probably worth trying with ghc 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:9 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by George): * cc: George (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#13062: `opt' failed in phase `LLVM Optimiser'. (Exit code: -11) -------------------------------------+------------------------------------- Reporter: 2bdkid | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 8.0.1 Resolution: worksforme | Keywords: LLVM | Optimiser -11 Operating System: Linux | Architecture: arm Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * status: new => closed * resolution: => worksforme Comment: Indeed I also suspect this is an ARM-specific LLVM crash. Closing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/13062#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC