[GHC] #11575: Program crashes only when compiled via LLVM

#11575: Program crashes only when compiled via LLVM --------------------------------------+---------------------------------- Reporter: Guest00000 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: None | Version: 7.10.3 Keywords: llvm | Operating System: Windows Architecture: x86_64 (amd64) | Type of failure: Runtime crash Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: --------------------------------------+---------------------------------- `llvm-test.hs`: {{{#!hs import System.IO import Foreign.Storable import Foreign.Marshal.Alloc import Data.Word main = do hSetBuffering stdout NoBuffering test 1000 test 5000 where test n = do allocaBytes (n * 4) $ \p -> do sequence_ [ pokeByteOff p (i * 4) (0x12345678 :: Word32) | i <- [ 0 .. n - 1 ] ] putStrLn $ show n ++ " fine" }}} ---- Cygwin shell: {{{ user@pc ~ $ ghc llvm-test.hs && ./llvm-test.exe [1 of 1] Compiling Main ( llvm-test.hs, llvm-test.o ) Linking llvm-test.exe ... 1000 fine 5000 fine user@pc ~ $ touch llvm-test.hs user@pc ~ $ ghc llvm-test.hs -fllvm && ./llvm-test.exe [1 of 1] Compiling Main ( llvm-test.hs, llvm-test.o ) Linking llvm-test.exe ... 1000 fine Segmentation fault }}} ---- {{{ <erikd> `Guest00000: try adding -O2 to the compiler command line. <`Guest00000> erikd: it now segfaults even before printing "1000 fine" <`Guest00000> wait, one time it printed one character "1" before crashing }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11575 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11575: Program crashes only when compiled via LLVM ----------------------------------+-------------------------------------- Reporter: Guest00000 | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: None | Version: 7.10.3 Resolution: | Keywords: llvm Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | ----------------------------------+-------------------------------------- Comment (by erikd): This code compiles and runs correctly on Linux/x86_64, both with and with `-fllvm`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11575#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#11575: Program crashes only when compiled via LLVM ----------------------------------+-------------------------------------- Reporter: Guest00000 | Owner: Type: bug | Status: closed Priority: normal | Milestone: Component: None | Version: 7.10.3 Resolution: duplicate | Keywords: llvm Operating System: Windows | Architecture: x86_64 (amd64) Type of failure: Runtime crash | Test Case: Blocked By: | Blocking: Related Tickets: #8974 | Differential Rev(s): Wiki Page: | ----------------------------------+-------------------------------------- Changes (by Phyx-): * status: new => closed * resolution: => duplicate * related: => #8974 Comment: Hi, sorry seem to have missed this ticket.. It seems to be a duplicate of #8974. A patch for this will be in GHC 8.2. If it is not, please re-open the ticket. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11575#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC