Repository : ssh://darcs.haskell.org//srv/darcs/testsuite On branch : master
http://hackage.haskell.org/trac/ghc/changeset/b6b39d75d924dae3b8dfabe9552e5492ac6a5ba1 >--------------------------------------------------------------- commit b6b39d75d924dae3b8dfabe9552e5492ac6a5ba1 Author: David Terei <[email protected]> Date: Wed Jan 18 01:33:52 2012 +0000 Add test for #5785. >--------------------------------------------------------------- tests/codeGen/should_run/5785.hs | 40 ++++++++++++++++++++++++++++++++++ tests/codeGen/should_run/5785.stdout | 24 ++++++++++++++++++++ tests/codeGen/should_run/all.T | 2 + 3 files changed, 66 insertions(+), 0 deletions(-) diff --git a/tests/codeGen/should_run/5785.hs b/tests/codeGen/should_run/5785.hs new file mode 100644 index 0000000..1b27f10 --- /dev/null +++ b/tests/codeGen/should_run/5785.hs @@ -0,0 +1,40 @@ +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) + diff --git a/tests/codeGen/should_run/5785.stdout b/tests/codeGen/should_run/5785.stdout new file mode 100644 index 0000000..f3d2115 --- /dev/null +++ b/tests/codeGen/should_run/5785.stdout @@ -0,0 +1,24 @@ +255 +65535 +4294967295 +18446744073709551615 +-1 +-1 +-1 +-1 +170 +48810 +2316287658 +2316287658 +-86 +-16726 +-1978679638 +2316287658 +170 +1706 +1212548778 +32342316287658 +-86 +1706 +1212548778 +32342316287658 diff --git a/tests/codeGen/should_run/all.T b/tests/codeGen/should_run/all.T index b47d4a8..0df805d 100644 --- a/tests/codeGen/should_run/all.T +++ b/tests/codeGen/should_run/all.T @@ -88,3 +88,5 @@ test('5149', omit_ways(['ghci']), multi_compile_and_run, test('5129', normal, 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('5785', normal, compile_and_run, ['']) + _______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
