on master help sign in
Merge remote-tracking branch 'upstream/master' into readme-llvm-ffi to fix reg016.
commit78233532a154d3945177748078fd606b1a0fcc5e authorDavid Christiansen <david@davidchristiansen.dk> dateFri 8 Nov 2013, 10:33 (13 years ago) parent8cbc611a9f062f
3 files changed+9−13
src/IRTS/CodegenLLVM.hs+2−1 test/reg016/expected+1−6 test/reg016/reg016.idr+6−6
src/IRTS/CodegenLLVM.hs+2−1
@@ -776,7 +776,8 @@ cgConst c@(TT.Str s) = do
776776 str <- addGlobal' (ArrayType (1 + fromIntegral (length s)) (IntegerType 8)) (cgConst' c)
777777 box FString (ConstantOperand $ C.GetElementPtr True str [C.Int 32 0, C.Int 32 0])
778778cgConst c@(TT.BI i) = do
779− str <- addGlobal' (ArrayType (1 + fromInteger (numDigits 10 i)) (IntegerType 8)) (cgConst' c)
779+ let stringRepLen = (if i < 0 then 2 else 1) + fromInteger (numDigits 10 i)
780+ str <- addGlobal' (ArrayType stringRepLen (IntegerType 8)) (cgConst' c)
780781 mpz <- alloc mpzTy
781782 inst $ simpleCall "__gmpz_init_set_str" [mpz
782783 , ConstantOperand $ C.GetElementPtr True str [ C.Int 32 0, C.Int 32 0]
test/reg016/expected+1−6
@@ -1,6 +1 @@
1−4294967295
2−4294967296
3−4294967297
4−-1
5−0
6−1
1+429496729500000000000000
test/reg016/reg016.idr+6−6
@@ -1,11 +1,11 @@
11module Main
22
33main : IO ()
4−main = do print $ the Integer 4294967295
5− print $ the Integer 4294967296
6− print $ the Integer 4294967297
7− print $ the Int 4294967295
8− print $ the Int 4294967296
9− print $ the Int 4294967297
4+main = do print $ the Integer 429496729500000000000000
5+-- print $ the Integer 4294967296
6+-- print $ the Integer 4294967297
7+-- print $ the Int 4294967295
8+-- print $ the Int 4294967296
9+-- print $ the Int 4294967297
1010
1111