Commit ef9249ee authored by dterei's avatar dterei
Browse files

Add test for #5785.

parent 0998987c
module Main where
import Data.Int
import Data.Word
-- Test case for bug #5785. The cause of this was that the LLVM backend
-- converted all Int constants using (fromInteger :: Int) and so on 32bit a
-- Int64 or Word32 would be truncated to 32bit! value before printing out.
main :: IO ()
main = do
-- first two should print as big numbers (as unsigned)
print (-1 :: Word8)
print (-1 :: Word16)
print (-1 :: Word32)
print (-1 :: Word64)
print (-1 :: Int8)
print (-1 :: Int16)
print (-1 :: Int32)
print (-1 :: Int64)
-- only requires 32 bits (unsigned)
print (2316287658 :: Word8)
print (2316287658 :: Word16)
print (2316287658 :: Word32)
print (2316287658 :: Word64)
print (2316287658 :: Int8)
print (2316287658 :: Int16)
print (2316287658 :: Int32)
print (2316287658 :: Int64)
-- this requries a 64 (unsigned) bit word to store correctly
print (32342316287658 :: Word8)
print (32342316287658 :: Word16)
print (32342316287658 :: Word32)
print (32342316287658 :: Word64)
print (32342316287658 :: Int8)
print (32342316287658 :: Int16)
print (32342316287658 :: Int32)
print (32342316287658 :: Int64)
255
65535
4294967295
18446744073709551615
-1
-1
-1
-1
170
48810
2316287658
2316287658
-86
-16726
-1978679638
2316287658
170
1706
1212548778
32342316287658
-86
1706
1212548778
32342316287658
...@@ -88,3 +88,5 @@ test('5149', omit_ways(['ghci']), multi_compile_and_run, ...@@ -88,3 +88,5 @@ test('5149', omit_ways(['ghci']), multi_compile_and_run,
test('5129', normal, compile_and_run, ['']) test('5129', normal, compile_and_run, [''])
test('5626', exit_code(1), compile_and_run, ['']) test('5626', exit_code(1), compile_and_run, [''])
test('5747', if_arch('i386', extra_hc_opts('-msse2')), compile_and_run, ['-O2']) test('5747', if_arch('i386', extra_hc_opts('-msse2')), compile_and_run, ['-O2'])
test('5785', normal, compile_and_run, [''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment