Skip to content

int-to-float conversion broken on ARM

I compiled ghc on the raspberry pi. See this bug for more about that build of ghc: 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]
Trac metadata
Trac field Value
Version 7.8.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system Linux
Architecture
Edited by Ansible
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information