[GHC] #9125: int-to-float conversion broken on ARM - 7.8.1-rc2

#9125: int-to-float conversion broken on ARM - 7.8.1-rc2 --------------------------+------------------------------------------------ Reporter: | Owner: Ansible | Status: new Type: bug | Milestone: Priority: normal | Version: 7.8.1 Component: | Operating System: Linux Compiler | Type of failure: Incorrect result at runtime Keywords: | Test Case: Architecture: arm | Blocking: Difficulty: | Unknown | Blocked By: | Related Tickets: | --------------------------+------------------------------------------------ I compiled ghc on the raspberry pi. See this bug for more about that build of ghc: [https://ghc.haskell.org/trac/ghc/ticket/8896 8896]. A simple test program: {{{ main = do mapM_ (print . (fromInteger :: Integer -> Float)) [0..100] }}} And the result: {{{ 0.0 127.0 256.0 257.0 516.0 517.0 518.0 519.0 1040.0 1041.0 1042.0 1043.0 1044.0 1045.0 1046.0 1047.0 2096.0 2097.0 2098.0 2099.0 2100.0 2101.0 2102.0 2103.0 2104.0 2105.0 2106.0 2107.0 2108.0 2109.0 2110.0 2111.0 4224.0 4225.0 4226.0 4227.0 4228.0 4229.0 4230.0 4231.0 4232.0 4233.0 4234.0 4235.0 4236.0 4237.0 4238.0 4239.0 4240.0 4241.0 4242.0 4243.0 4244.0 4245.0 4246.0 4247.0 4248.0 4249.0 4250.0 4251.0 4252.0 4253.0 4254.0 4255.0 8512.0 8513.0 8514.0 8515.0 8516.0 8517.0 8518.0 8519.0 8520.0 8521.0 8522.0 8523.0 8524.0 8525.0 8526.0 8527.0 8528.0 8529.0 8530.0 8531.0 8532.0 8533.0 8534.0 8535.0 8536.0 8537.0 8538.0 8539.0 8540.0 8541.0 8542.0 8543.0 8544.0 8545.0 8546.0 8547.0 8548.0 8538.0 }}} This code, however, works normally: {{{ main = do mapM_ (print . (fromInteger :: Integer -> Double)) [0..100] }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM - 7.8.1-rc2 ------------------------------------------------+-------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.1 Resolution: | Keywords: Operating System: Linux | Architecture: arm Type of failure: Incorrect result at runtime | Difficulty: Test Case: | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Comment (by amurrayc): I have the same problem on iOS (simulator or device) with 7.8.2 or 7.8.3 compiled from source tarballs. I'm not sure if it should be a separate ticket. I don't think this is an `Integer` to `Float` problem per se. If I run {{{ print (F# 29.0#) -- to pick a value at random }}} I get {{{ 2109.0 }}} as in the original ticket. This should be using a direct `Float` literal, no? A little digging showed that {{{ print (floor (29.0 :: Float) :: Int) }}} shows {{{ 2109 }}} with no optimisation, but {{{ 29 }}} with `-O` Another clue is that `floor :: Float -> Integer` doesn't give the correct result, even with `-O`. Optimised `floor :: Float -> Int` uses the primop `float2Int#` while its unoptimised version and both versions of `floor :: Float -> Integer` use `decodeFloat_Int#` as does `show :: Float -> String` which last explains the original ticket. running {{{ let (m,e) = decodeFloat (29.0 :: Float) mstr = printf "%#x" m putStrLn $ "(" ++ mstr ++ ", " ++ show e ++ ")" }}} gives {{{ (0x41e80000, -19) }}} instead of the correct {{{ (0xe80000, -19) }}} Notably the erroneous `0x41e80000` is the correct value for the entire bitfield of `29.0 :: Float#` rather than just the mantissa. This all suggests that the problem lies within `decodeFloat_Int#`. I looked at `__decodeFloat_Int` in `rts/StgPrimFloat.c`, even inserting a couple of `assert`s at the end to check the values for 29.0 which passed. That led me to look at `stg_decodeFloatzuIntzh` in `rts/PrimOps.cmm` but at that point I was getting a bit lost. Any ideas anyone? For the record I'm running the above snippets in a simple Haskell `Main.hs` like: {{{ {-# LANGUAGE ForeignFunctionInterface #-} module Main where import Foreign import Text.Printf ( printf ) foreign import ccall safe "c_main" c_main :: IO () main = do let (m,e) = decodeFloat (29.0 :: Float) mstr = printf "%#x" m putStrLn $ "(" ++ mstr ++ ", " ++ show e ++ ")" c_main }}} with a skeleton Xcode 5.1.1 project and observing the results in the debug window. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM - 7.8.1-rc2 ------------------------------------------------+-------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Incorrect result at runtime | Difficulty: Test Case: | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by amurrayc): * cc: murray@… (added) * version: 7.8.1 => 7.8.3 * os: Linux => Unknown/Multiple -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM - 7.8.1-rc2 ------------------------------------------------+-------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Incorrect result at runtime | Difficulty: Test Case: | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- Changes (by simonpj): * priority: normal => highest * milestone: => 7.8.4 Comment: I have not tried to reproduce any of this, but it looks like a solid, well-characterised bug to me. Could anyone spare the time to investigate, please? Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM ------------------------------------------------+-------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Incorrect result at runtime | Difficulty: Test Case: | Unknown Blocking: | Blocked By: | Related Tickets: ------------------------------------------------+-------------------------- -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Differential Revisions: | Operating System: Unknown/Multiple Architecture: arm | Type of failure: Incorrect result Difficulty: Unknown | at runtime Blocked By: | Test Case: Related Tickets: | Blocking: -------------------------------------+------------------------------------- Comment (by amurrayc): So here's a thing: On a hunch I switched the assignments of `r1` and `r2` in `stg_decodeFloatzuIntzh` so that it now reads {{{ r2 = W_[mp_tmp1]; r1 = W_[mp_tmp_w]; }}} with everything else the same. What do you know, {{{ let (m,e) = decodeFloat (29.0 :: Float) estr = printf "%#x" e putStrLn $ "(" ++ show m ++ ", " ++ estr ++ ")" }}} gives {{{ (-19, 0xe80000) }}} Does that give anyone any clues? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Differential Revisions: | Operating System: Unknown/Multiple Architecture: arm | Type of failure: Incorrect result Difficulty: Unknown | at runtime Blocked By: | Test Case: Related Tickets: | Blocking: -------------------------------------+------------------------------------- Comment (by amurrayc): I'm still learning about Cmm and calling conventions &c. so forgive my stumblings. If I modify `stg_decodeFloatzuIntzh` so that the two temporary pointers are shifted by one word the function returns the correct value. That is {{{ reserve 2 = tmp { mp_tmp1 = tmp + WDS(1); mp_tmp_w = tmp; }}} becomes {{{ reserve 3 = tmp { mp_tmp1 = tmp + WDS(2); mp_tmp_w = tmp + WDS(1); }}} With this change everything seems to work correctly. I'm confused though. The pointer that was getting clobbered by the argument value was `tmp + WDS(1)` but now `mp_tmp_w` i.e. the exponent is fine. Anyway, I hope this give someone wiser a clue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Differential Revisions: | Operating System: Unknown/Multiple Architecture: arm | Type of failure: Incorrect result Difficulty: Unknown | at runtime Blocked By: | Test Case: Related Tickets: | Blocking: -------------------------------------+------------------------------------- Changes (by bgamari): * cc: bgamari@… (added) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: new Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: arm Unknown/Multiple | Difficulty: Unknown Type of failure: Incorrect | Blocked By: result at runtime | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): My Android cross-compiler (built with my fork https://github.com/rwbarton /ghc-android) produces the correct output `0.0\n1.0\n...100.0\n`. Can someone who sees the wrong output attach the object files `rts/dist/build/PrimOps.o`, `rts/dist/build/StgPrimFloat.o` to this ticket? (Or their disassemblies—particularly if they are not ELF object files.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:8 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM
-------------------------------------+-------------------------------------
Reporter: Ansible | Owner:
Type: bug | Status: new
Priority: highest | Milestone: 7.8.4
Component: Compiler | Version: 7.8.3
Resolution: | Keywords:
Operating System: | Architecture: arm
Unknown/Multiple | Difficulty: Unknown
Type of failure: Incorrect | Blocked By:
result at runtime | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by rwbarton):
Here is the disassembly of `stg_decodeFloatzuIntzh` from that build,
annotated with my primitive understanding of ARM assembly. It's ... not
right.
{{{
0000051c

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 Resolution: | Keywords: Operating System: | Architecture: arm Unknown/Multiple | Difficulty: Unknown Type of failure: Incorrect | Blocked By: result at runtime | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by rwbarton): * status: new => infoneeded Comment: I think that something is reordering the assignment to R1 with the call to `__decodeFloat_Int`. After all, R1 is supposed to receive the value that ends up at `Sp[-4]`, which is set to F1 at the top of the function. Not sure whether GHC or LLVM is doing this incorrect reordering. It would be informative to * build the broken GHC * `rm rts/dist/build/PrimOps.o` * run `make` again and copy the command used to build `rts/dist/build/PrimOps.o` * rerun the command with `-v -keep-tmp-files -ddump-cmm -ddump-to-file` * find the files `rts/PrimOps.dump-cmm` and `/tmp/ghc*/ghc*.ll` and attach them to this ticket -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:10 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by hvr): * cc: hvr, simonmar (added) * component: Compiler => Compiler (CodeGen) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:11 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonmar): Yes, let's see the `-ddump-cmm` for `PrimOps.cmm` please. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:12 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by bgamari): I think you will also need to add `-keep-llvm-files` to the command line as well. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:13 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by Ansible): I was just trying to determine the version of LLVM on my PI, and found a lot of files with "3.0" in the name. So I'm guessing version 3.0. The process of searching for the files resulted in a 'kernel journaling error' of some sort, IIRC, and now the thing won't boot. If more specific version information is needed let me know. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:14 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): I don't know whether this is the actual problem, but I think our TBAA is going wrong on this code. I tried to build GHC for Android with `-march=armv6`, so that it would use the floating point registers `s16` and so on. The build didn't finish for other reasons, but it got far enough to build `PrimOps.cmm`. Here is the `-ddump-cmm`: {{{ ==================== Post CPS Cmm ==================== [...] stg_decodeFloatzuIntzh() // [F1] { info_tbl: [] stack_info: arg_space: 0 updfr_space: Nothing } {offset c4w: F32[Sp - 4] = F1; Sp = Sp - 8; call block_c4o_info() args: 0, res: 0, upd: 0; } }, block_c4o_entry() // [] { info_tbl: [(c4o, label: block_c4o_info rep:StackRep [True])] stack_info: arg_space: 0 updfr_space: Nothing } {offset c4o: if ((Sp + 4) < SpLim) goto c4q; else goto c4r; c4q: I32[Sp] = block_c4o_info; call stg_gc_noregs() args: 4, res: 4, upd: 4; c4r: _c4k::I32 = Sp + 4; call "ccall" arg hints: [PtrHint, PtrHint,] result hints: [] __decodeFloat_Int(_c4k::I32, Sp, F32[Sp + 4]); R2 = I32[Sp]; R1 = I32[_c4k::I32]; Sp = Sp + 8; call (P32[Sp])(R2, R1) args: 4, res: 0, upd: 4; } }, }}} What's unusual about this is that R1 is read by dereferencing the variable `_c4k`, even though the address it points to lives on the stack. This violates the assumptions made by our TBAA: https://ghc.haskell.org/trac/ghc/wiki/Commentary/Compiler/Backends/LLVM/Alia... And indeed, in the `.ll` file, the read of R2 is done using the "stack" type, but the read of R1 is done using the "other" type, which supposedly cannot alias the "stack" type. However, while it seems potentially relevant, I don't see specifically how this could cause our problem. (And my LLVM produced the correct assembly for `stg_decodeFloatzuIntzh`.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:15 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:9 rwbarton]: As per the warning on https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS I am using LLVM 3.0 binaries from http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz I can try recompiling with 3.5. Would it still be useful to have the -ddump-cmm? I just got back to my computer after a few days away but I could easily do that. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Replying to [comment:16 amurrayc]:
Replying to [comment:9 rwbarton]:
As per the warning on https://ghc.haskell.org/trac/ghc/wiki/Building/CrossCompiling/iOS I am using LLVM 3.0 binaries from http://llvm.org/releases/3.0/clang+llvm-3.0-x86_64-apple-darwin11.tar.gz
I can try recompiling with 3.5. Would it still be useful to have the -ddump-cmm? I just got back to my computer after a few days away but I could easily do that.
Let's figure out whether this is a bug in GHC or LLVM before we change any variables like the version of LLVM. I think LLVM 3.5 won't work with GHC 7.8 anyways. (Ben?) Yes, the -ddump-cmm output would still be useful. If you still have your built ghc tree, then you can follow the steps I listed above, skipping the first step. Thanks! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:17 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:17 rwbarton]: Okay, I attached them. Hope that helps. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:18 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Thanks. Actually, for completeness, can you attach your `rts/dist/build/PrimOps.o` too? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:19 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:19 rwbarton]:
Thanks. Actually, for completeness, can you attach your `rts/dist/build/PrimOps.o` too?
Done. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:20 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by bgamari): Replying to [comment:17 rwbarton]:
Let's figure out whether this is a bug in GHC or LLVM before we change any variables like the version of LLVM. I think LLVM 3.5 won't work with GHC 7.8 anyways. (Ben?)
Indeed LLVM 3.5 disagrees with the aliases that the LLVM backend produces (in all GHC versions as far as I know). This is being tracked in #9142 where you'll find a patch that I threw together to rework the LLVM code generator to comply with LLVM's new restrictions on alias usage. The patch works with LLVM 3.4 and should work for 3.5 although I'm still waiting for the build to finish to verify this. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:21 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by simonmar): The Cmm code looks ok to me. Maybe someone could trace through with gdb to find out where the error is? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:22 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): The Cmm code is fine. As far as I can tell, the .ll file is mostly fine except we do write to a memory location (the original Sp - 4) using TBAA metadata 1 and then later read from the same memory location (and LLVM knows it) using TBAA metadata 5. I lost my disassembly of the object file but it is wrong in a similar way to the assembly I annotated above: LLVM coalesces this store and read to a register move, presumably because it thinks for some reason that the intervening function call can not modify the memory. I don't see why it would assume this, but then again we did tell it via TBAA that two memory accesses would not alias that are in fact to the same address, so I suppose it is within its rights to do anything. amurrayc, can you try with this patch applied (effectively reverting e10589a505b44f4f0394500c6a0d2db5baa7f3f4): {{{ diff --git a/compiler/llvmGen/LlvmCodeGen/Regs.hs b/compiler/llvmGen/LlvmCodeGen/Regs.hs index 0048659..d837d13 100644 --- a/compiler/llvmGen/LlvmCodeGen/Regs.hs +++ b/compiler/llvmGen/LlvmCodeGen/Regs.hs @@ -101,11 +101,6 @@ stgTBAA , (heapN, fsLit "heap", Just topN) , (rxN, fsLit "rx", Just heapN) , (baseN, fsLit "base", Just topN) - -- FIX: Not 100% sure about 'others' place. Might need to be under 'heap'. - -- OR I think the big thing is Sp is never aliased, so might want - -- to change the hieracy to have Sp on its own branch that is never - -- aliased (e.g never use top as a TBAA node). - , (otherN, fsLit "other", Just topN) ] -- | Id values @@ -115,7 +110,7 @@ stackN = getUnique (fsLit "LlvmCodeGen.Regs.stackN") heapN = getUnique (fsLit "LlvmCodeGen.Regs.heapN") rxN = getUnique (fsLit "LlvmCodeGen.Regs.rxN") baseN = getUnique (fsLit "LlvmCodeGen.Regs.baseN") -otherN = getUnique (fsLit "LlvmCodeGen.Regs.otherN") +otherN = topN -- | The TBAA metadata identifier tbaa :: LMString }}} If you can try a newer version of LLVM like 3.4, that would be great also. That version is newer than the admonitions to use 3.0 on the wiki page, so it's possible the LLVM bugs have been worked out in 3.4. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:23 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): The patch didn't do anything (although I only applied it and re-`make && make install`-ed it. Should I have done a full `make clean && configure ...`?) However, LLVM 3.4 seems to work. It at least produces {{{ 29.0 }}} when fed {{{ main = print (29.0 :: Float) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:24 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Replying to [comment:24 amurrayc]:
The patch didn't do anything (although I only applied it and re-`make && make install`-ed it. Should I have done a full `make clean && configure ...`?)
You don't need to rerun `configure`, but yeah you will need to rebuild the stage1 compiler so that it can rebuild the RTS correctly, and `make clean` is the easiest way.
However, LLVM 3.4 seems to work. It at least produces {{{ 29.0 }}} when fed {{{ main = print (29.0 :: Float) }}}
Well that's good to know, at least! I still think our TBAA information is wrong for this code, though. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:25 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

Replying to [comment:24 amurrayc]:
The patch didn't do anything (although I only applied it and re-`make && make install`-ed it. Should I have done a full `make clean && configure ...`?)
You don't need to rerun `configure`, but yeah you will need to rebuild
#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:25 rwbarton]: the stage1 compiler so that it can rebuild the RTS correctly, and `make clean` is the easiest way. Okay, finally done. The patch (properly remade) doesn't seem to improve things with LLVM 3.0. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:26 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Curious. Would you mind extracting the `.cmm` and `.ll` and `.o` files in the same way as before, so I can make sure the patch is having the expected effect? If it is then I think we can declare this to be a bug in LLVM 3.0. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:27 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): I'm just about to attach them. Would it help to see those files for the 3.4 build too? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:28 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Hopefully the `.cmm` and `.ll` files will be the same, but sure, let's have the 3.4 `.o` file too for the record. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:29 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Oops, I just realised that the first set of files I attached were from the device build but, as I've been away from my iPad for a few days the version I generated now is for the simulator. Both have been misbehaving in the same way though. I'm back with the device but I have to recompile the device version from scratch. I'll attach the simulator files. I can get the device files too but it'll take a while. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:30 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Actually I prefer this one, since I can read x86 assembly better than ARM assembly :) The TBAA patch had the expected effect on the .ll file. But LLVM 3.0 still decided to carefully save the input value across the function call so that it can erroneously return it as the result (esi). {{{ 00000748 83ec1c sub esp, 0x1c 0000074b 8d45fc lea eax, [ebp-4] 0000074e 3bab1c030000 cmp ebp, [ebx+0x31c] 00000754 7235 jc 0x78b 00000756 f30f104500 movss xmm0, [ebp] 0000075b f30f11442418 movss [esp+0x18], xmm0 00000761 f30f11442408 movss [esp+0x8], xmm0 00000767 89442404 mov [esp+0x4], eax 0000076b 892c24 mov [esp], ebp 0000076e e815faffff call __decodeFloat_Int 00000773 8b45fc mov eax, [ebp-4] 00000776 894500 mov [ebp], eax 00000779 8b4504 mov eax, [ebp+0x4] 0000077c f30f10442418 movss xmm0, [esp+0x18] 00000782 660f7ec6 movd esi, xmm0 00000786 83c41c add esp, 0x1c 00000789 ffe0 jmp eax }}} I think this is just a bug in LLVM 3.0, particularly as you say LLVM 3.4 has the expected behavior. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:31 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Thanks. Indeed that object file looks much more sensible. Would you mind trying one more thing with LLVM 3.0 (with either the original or patched source tree)? Could you find the BuildFlavour stanza you are using in `mk/build.mk` (or just globally replace all of them if not sure) and change all occurrences of `-fllvm` to `-fllvm -fno-llvm- tbaa`? Curious if that would fix the issue. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:32 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:32 rwbarton]:
Would you mind trying one more thing with LLVM 3.0 (with either the original or patched source tree)? Could you find the BuildFlavour stanza you are using in `mk/build.mk` (or just globally replace all of them if not sure) and change all occurrences of `-fllvm` to `-fllvm -fno-llvm- tbaa`? Curious if that would fix the issue.
That did not appear to change anything for the better. I tried building the device (ARM) compiler with LLVM 3.4 but it failed. I suppose this is related to the info in comment:21. I'm trying now with the patch mentioned there. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:33 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): To summarise: Both the simulator and device builds of GHC 7.8.3 (for iOS) behave incorrectly when compiled with LLVM 3.0. None of the suggested alterations fixes this. The simulator builds with LLVM 3.4 and behaves correctly. The device version fails to build with 3.4. Can anyone suggest which combination of GHC branch and recent LLVM I should be trying with? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:34 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by rwbarton): Try applying https://phabricator.haskell.org/D208 to HEAD. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:35 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: highest | Milestone: 7.8.4 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: | Difficulty: Unknown Unknown/Multiple | Blocked By: Type of failure: Incorrect | Related Tickets: result at runtime | Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by amurrayc): Replying to [comment:35 rwbarton]:
Try applying https://phabricator.haskell.org/D208 to HEAD.
Doing so fails with {{{ error: out of range pc-relative fixup value vldr d8, LCPI102_0 }}} This is with LLVM 3.4. I'm going to try with LLVM 3.5. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:36 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * priority: highest => high Comment: Moving down in priority since this hasn't seen any updates; @bgamari, think you could look into this maybe? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:38 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by amurrayc): I tried again with the 7.10 rc candidate (7.10.0.20141222) with LLVM 3.4 and got the same error as comment:36. Should this be a new ticket? The original problem seems solved in the simulator build by compiling with 3.4. I left some more details a while back on the list https://www.haskell.org/pipermail/ghc-devs/2014-October/006521.html The error occurs while compiling `libraries/integer- simple/GHC/Integer/Type.hs`. I don't really speak ARM assembly but the error appears to be in the `doubleFromPositive` section. I note that the label LCPI102_0 refers to a point near the beginning of the file and that from http://infocenter.arm.com/help/topic/com.arm.doc.dui0489c/Bcfcdfdd.html it seems that the label in a vldr instruction needs to point somewhere within 1KB of the current instruction. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:39 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by rwbarton): Could you run ghc with `-keep-tmp-files` and attach both the pre- and post-mangling assembly files? (IIRC, these have extensions `.ll_s` and `.s` respectively.) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:40 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.10.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by Ansible): FWIW, installed arch today on a banana pi, and installed ghc with pacman. The problem does not occur there. {{{ [root@lemaker bananapi]# pacman -Q llvm llvm 3.5.1-1 [root@lemaker bananapi]# ghc --version The Glorious Glasgow Haskell Compilation System, version 7.8.2 }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:41 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.12.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Changes (by thoughtpolice): * milestone: 7.10.1 => 7.12.1 Comment: OK, so right now Ben Gamari and I are working on fixing up the LLVM backend in HEAD soon by shipping a known good version of LLVM for users to use; the new changes require LLVM 3.6 but seems to be stable on ARM and x86. So I'm punting this one out to 7.12 for now, since hopefully it will be fixed by using a fixed compiler with good test results. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:42 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.12.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Keywords: Resolution: | Architecture: arm Operating System: Unknown/Multiple | Test Case: Type of failure: Incorrect result | Blocking: at runtime | Differential Revisions: Blocked By: | Related Tickets: | -------------------------------------+------------------------------------- Comment (by amurrayc): Aha! I finally got the device compiler to build using HEAD with LLVM 3.6 from homebrew. I had to modify the ghc-ios-scripts to pick up clang from the homebrew 3.6 install but it seems to work. The test case prints out 29.0 as expected. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:43 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: infoneeded Priority: high | Milestone: 7.12.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Incorrect result | Test Case: at runtime | Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by thomie): With #10074, ./configure checks for llvm-3.6 to be installed, with which this problem does not occur, according to comment:43. Replying to [comment:25 rwbarton]:
Well that's good to know, at least! I still think our TBAA information is wrong for this code, though.
Is that the reason this ticket is still open? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:44 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM -------------------------------------+------------------------------------- Reporter: Ansible | Owner: Type: bug | Status: closed Priority: high | Milestone: 7.12.1 Component: Compiler | Version: 7.8.3 (CodeGen) | Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: arm Type of failure: Incorrect result | Test Case: at runtime | Blocked By: | Blocking: Related Tickets: | Differential Revisions: -------------------------------------+------------------------------------- Changes (by rwbarton): * status: infoneeded => closed * resolution: => invalid Comment: The TBAA issue is tracked at #9504, so we can close this one as "bug in LLVM 3.0". -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9125#comment:45 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9125: int-to-float conversion broken on ARM
-------------------------------------+-------------------------------------
Reporter: Ansible | Owner:
Type: bug | Status: closed
Priority: high | Milestone: 8.0.1
Component: Compiler | Version: 7.8.3
(CodeGen) |
Resolution: invalid | Keywords:
Operating System: Unknown/Multiple | Architecture: arm
Type of failure: Incorrect result | Test Case:
at runtime |
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
-------------------------------------+-------------------------------------
Comment (by Ben Gamari
participants (1)
-
GHC