
#8250: cgrun072 (optllvm) failing ------------------------------------+------------------------------------- Reporter: leroux | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: Runtime crash Difficulty: Unknown | Test Case: cgrun072 Blocked By: | Blocking: Related Tickets: 7902 | ------------------------------------+------------------------------------- * Platform: OS X 10.8.4 x86_64 * GHC Version 7.7.20130904 (built with gcc-4.8) To reproduce this: {{{ $ make test TEST=cgrun072 WAY=optllvm }}} Expected output (for failure): {{{ =====> cgrun072(optllvm) 172 of 3749 [0, 0, 2] cd ./codeGen/should_run && '/Users/leroux/Dropbox/src/ghc/ghc- validate/inplace/bin/ghc-stage2' -fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db -rtsopts -fno-ghci-history -o cgrun072 cgrun072.hs -O -fllvm >cgrun072.comp.stderr 2>&1 cd ./codeGen/should_run && ./cgrun072 cgrun072.run.stdout 2>cgrun072.run.stderr Actual stdout output differs from expected: --- ./codeGen/should_run/cgrun072.stdout 2013-09-04 02:22:32.000000000 -0500 +++ ./codeGen/should_run/cgrun072.run.stdout 2013-09-07 03:27:09.000000000 -0500 @@ -1,3 +1,6 @@ OK -OK +FAIL + Input: 1480294021 +Expected: 2239642456 + Actual: -2055324840 OK *** unexpected failure for cgrun072(optllvm) }}} The failing test case is {{{test_bSwap32}}}. Here are some relevant snippets. bswap and cgrun072 were added in #7902. https://github.com/ghc/testsuite/blob/master/tests/codeGen/should_run/cgrun0...: {{{ bswap32 :: Word32 -> Word32 bswap32 (W32# w#) = W32# (byteSwap32# w#) slowBswap32 :: Word32 -> Word32 slowBswap32 w = (w `shiftR` 24) .|. (w `shiftL` 24) .|. ((w `shiftR` 8) .&. 0xff00) .|. ((w .&. 0xff00) `shiftL` 8) test_bSwap32 = test casesW32 bswap32 slowBswap32 }}} https://github.com/ghc/packages-ghc- prim/blob/master/cbits/bswap.c#L10-L17: {{{ extern StgWord32 hs_bswap32(StgWord32 x); StgWord32 hs_bswap32(StgWord32 x) { return ((x >> 24) | ((x >> 8) & 0xff00) | (x << 24) | ((x & 0xff00) << 8)); } }}} Here are a few things to look at or try. * https://github.com/ghc/packages-ghc-prim/blob/master/cbits/bswap.c * https://github.com/ghc/ghc/tree/master/compiler/llvmGen * Maybe take an object dump and take what's going on. * gdb debugging? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8250 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler