
#10010: LLVM/optimized code for sqrt incorrect for negative values -------------------------------------+------------------------------------- Reporter: glguy | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler (LLVM) | Version: 7.8.4 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Incorrect result | Unknown/Multiple at runtime | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by George): This appears to be fixed in ghc 8.4.1 and llvm 6.0. The supported llvm for 8.4.1 is 5.0 but I have 6.0 as I'm on a Mac and did a brew update which overwrote 5.0 and installed 6.0. Can somebody verify with llvm 5.0? The following shows it works as described above: {{{ bash-3.2$ ghc --version The Glorious Glasgow Haskell Compilation System, version 8.4.1 bash-3.2$ opt -version LLVM (http://llvm.org/): LLVM version 6.0.0 Optimized build. Default target: x86_64-apple-darwin17.4.0 Host CPU: nehalem bash-3.2$ llc -version LLVM (http://llvm.org/): LLVM version 6.0.0 Optimized build. Default target: x86_64-apple-darwin17.4.0 Host CPU: nehalem ... ghc -O -fllvm Sqrt.hs [1 of 1] Compiling Main ( Sqrt.hs, Sqrt.o ) You are using an unsupported version of LLVM! Currently only 5.0 is supported. We will try though... Linking Sqrt ... bash-3.2$ ./Sqrt NaN bash-3.2$ }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10010#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler