on master help sign in
Merge remote-tracking branch 'upstream/master' into readme-llvm-ffi to fix reg016.
7823353David Christiansen
src/IRTS/CodegenLLVM.hs+2−1
@@ -776,7 +776,8 @@ cgConst c@(TT.Str s) = do
776 str <- addGlobal' (ArrayType (1 + fromIntegral (length s)) (IntegerType 8)) (cgConst' c)
776 str <- addGlobal' (ArrayType (1 + fromIntegral (length s)) (IntegerType 8)) (cgConst' c)
777 box FString (ConstantOperand $ C.GetElementPtr True str [C.Int 32 0, C.Int 32 0])
777 box FString (ConstantOperand $ C.GetElementPtr True str [C.Int 32 0, C.Int 32 0])
778cgConst c@(TT.BI i) = do
778cgConst 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)
780 mpz <- alloc mpzTy
781 mpz <- alloc mpzTy
781 inst $ simpleCall "__gmpz_init_set_str" [mpz
782 inst $ simpleCall "__gmpz_init_set_str" [mpz
782 , ConstantOperand $ C.GetElementPtr True str [ C.Int 32 0, C.Int 32 0]
783 , ConstantOperand $ C.GetElementPtr True str [ C.Int 32 0, C.Int 32 0]
test/reg016/expected+1−6
@@ -1,6 +1 @@
1−4294967295
1+429496729500000000000000
2−4294967296
3−4294967297
4−-1
5−0
6−1
test/reg016/reg016.idr+6−6
@@ -1,11 +1,11 @@
1module Main
1module Main
2
2
3main : IO ()
3main : IO ()
4−main = do print $ the Integer 4294967295
4+main = do print $ the Integer 429496729500000000000000
5− print $ the Integer 4294967296
5+-- print $ the Integer 4294967296
6− print $ the Integer 4294967297
6+-- print $ the Integer 4294967297
7− print $ the Int 4294967295
7+-- print $ the Int 4294967295
8− print $ the Int 4294967296
8+-- print $ the Int 4294967296
9− print $ the Int 4294967297
9+-- print $ the Int 4294967297
10
10
11
11