[GHC] #7684: cgrun071 segfaults
GHC
ghc-devs at haskell.org
Thu Sep 5 09:20:10 CEST 2013
#7684: cgrun071 segfaults
----------------------------------+----------------------------------
Reporter: tibbe | Owner: leroux
Type: bug | Status: new
Priority: normal | Milestone: 7.8.1
Component: Compiler | Version: 7.7
Resolution: | Keywords:
Operating System: MacOS X | Architecture: x86_64 (amd64)
Type of failure: Runtime crash | Difficulty: Unknown
Test Case: cgrun071 | Blocked By:
Blocking: | Related Tickets:
----------------------------------+----------------------------------
Comment (by leroux):
The problem has been pinpointed to the fact that apple-gcc42 does not
support SSE4 instructions.
After carter suggested that it may be a problem with apple-gcc42, I
rebuilt ghc with gcc48 and cgrun071 passed both the normal and llvm ways.
It seems that carter's theory was right in that gcc 4.2 does not have
support for SSE4 instructions. In fact, support for SSE4 was added in with
the release of gcc43. http://gcc.gnu.org/gcc-4.3/changes.html
It may be that SSE42 support isn't being detected properly by nativeGen.
https://github.com/ghc/ghc/blob/master/compiler/nativeGen/X86/CodeGen.hs#L1686-L1689
When reproducing this, #8148 may get in the way. carter's helpful fix is
to simply symlink to `gcc-4.8` as `gcc` and, add it to your PATH, then
build ghc as normal.
{{{
$ mkdir ~/bin
$ ln -s `which gcc-4.8` ~/bin/gcc
$ export PATH=~/bin:$PATH
$ # reload your shell and `gcc -v` should show 4.8 or whatever.
}}}
Should we switch to calling the "slower" popCount for this certain case?
https://github.com/ghc/testsuite/blob/master/tests/codeGen/should_run/cgrun071.hs#L41-L46
{{{
slowPopcnt :: Word -> Word
slowPopcnt x = count' (bitSize x) x 0
where
count' 0 _ !acc = acc
count' n x acc = count' (n-1) (x `shiftR` 1)
(acc + if x .&. 1 == 1 then 1 else 0)
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/7684#comment:19>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list