ghci-6.6 crash
During a long (10 to 15 minute) run of a communication system simulation, I noticed had occasional crashes of ghci with the output
<interactive>: internal error: interpretBCO: unknown or unimplemented opcode 1028
(GHC version 6.6 for powerpc_apple_darwin)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Abort trap
gregory-wrights-powerbook-g4-17>
or
<interactive>: internal error: interpretBCO: unknown or unimplemented opcode 1033
(GHC version 6.6 for powerpc_apple_darwin)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Abort trap
a83-245-238-133>
or
<interactive>: internal error: interpretBCO: unknown or unimplemented opcode 1040
(GHC version 6.6 for powerpc_apple_darwin)
Please report this as a GHC bug: http://www.haskell.org/ghc/reportabug
Abort trap
a83-245-238-133>
The same code when compiled would run to completion.
I could not post the original code because it contained proprietary customer information. However, I have been able to isolate a much smaller case which also fails.
The module below, which computes a 16 bit checksum function, fails when run under ghci with
[9,120,46,192,248,87,242,122,183,2,96,217,164,46]
85:
[203,223,98,240,74,91,106]
86:
[78,239,201,3,74,238,146,170,71]
87:
[46,128,19,27,218,48,10,148test aborted: <<loop>>
*Main>
The same code runs to completion when compiled:
[15,76,203,225,63,86,10,21,39,140,91,244,38,101,10,197,212,24,242,50,105,139,139,210,108,79,185,171,127,232,57,37,77,234,164,47,175,91,78,198,237,253,153,83,159,7,11,30,138,150,19,68,10,234,46,101,39,146,46,164,52,54,109,163,46,174,22,46,61,43,234,125,148,182,188,19,4,48,84,227,57,156,152,55,235,211,204,10,104,170,40,209,174,238,200,16,82,204,203,133,196,42,146,8,66,171,67,142,208,67,67,37,237,48,249,99,212,152,79,52,136,104,187,218,6,73,174,244,146,118,202,141,26,79,34,91,10,167,41,244,151,47,28,35,181,199,244,233,221,118,64,53,59,245,245,166,255,86,124,37,192,175,203,184,52,155,141,66,247,227,51,40,154,150,9,121,215,237,21,23,60,83,31,27,23,128,18,83,17,119,136,73,46,60,242,79,190,189,56,154,229,47,92,242,81,157,251,51,27,4,93,213,103,176,144,43,12,187,5,85,109,42,194,214,30,110,129,129,197,97,239,210,133,201,180,207,123,120,62,106,47,30,1,207,30,213,219,210,158,67,101,164,149,85,6,138,52,55,64,160,85,119,132,247,226,255,29,3,122,235,217,228,83,197,157,41,208,138,23,152,48,93,53,223,40,168,17,129,29,48,250,31,136,4,213,136,178,70,10,207,43,48,69,157,71,31,119,137,137]
997:
[48,92,91,80,79,62,248,169,156,171,156,102,154,114]
998:
[15,114,1,127,222,71,195,235,182,211,65,168,67,179,4,19,254,43,233,199,198,183,24,14,172,222,226,46,159,82,3,193,193,217,220,132,152,241,159,127,177,210,117,82,209,63,204,101,150,202,45,180,42,156,185,8,110,231,86,232,25,112,80,170,185,19,251,161,111,129,248,165,179,223,161,147,71,248,192,21,223,148,130,11,241,98,20,49,23,3,29,29,253,173,66,3,145,39,80,94,51,30,221,168,120,184,34,26,11,156,197,135,223,150,105,131,44,83,240,223,100,135,234,90,9,126,151,231,251,155,206,248,82,106,246,57,69,79,126,33,48,238,30,3,126,98,83,187,176]
999:
[75,152,189,37,228,208,62,124,131,3,10,115,211,204,85,147,90,85,99,165,239,44,78,114,117,68,255,230,78,248,36,211,116,120,69,30,126,96,46,95,207,157,63,232,198,5,197]
test ok: 1000
~/src/haskell/simulator $
The module is
{-# OPTIONS_GHC -fglasgow-exts #-}
--
-- Checksum.hs, support for checksumming data.
--
--module Checksum (
-- checksum
--) where
module Main where
import Utils
import Control.Exception
import Data.Array
import Data.Bits
import Data.List
import Data.Word
import Test.QuickCheck
import Test.QuickCheck.Batch
crcTable :: Array Word8 Word16
crcTable = listArray (0, 255)
[ 0x0000, 0x5935, 0xB26A, 0xEB5F, 0x3DE1, 0x64D4, 0x8F8B, 0xD6BE,
0x7BC2, 0x22F7, 0xC9A8, 0x909D, 0x4623, 0x1F16, 0xF449, 0xAD7C,
0xF784, 0xAEB1, 0x45EE, 0x1CDB, 0xCA65, 0x9350, 0x780F, 0x213A,
0x8C46, 0xD573, 0x3E2C, 0x6719, 0xB1A7, 0xE892, 0x03CD, 0x5AF8,
0xB63D, 0xEF08, 0x0457, 0x5D62, 0x8BDC, 0xD2E9, 0x39B6, 0x6083,
0xCDFF, 0x94CA, 0x7F95, 0x26A0, 0xF01E, 0xA92B, 0x4274, 0x1B41,
0x41B9, 0x188C, 0xF3D3, 0xAAE6, 0x7C58, 0x256D, 0xCE32, 0x9707,
0x3A7B, 0x634E, 0x8811, 0xD124, 0x079A, 0x5EAF, 0xB5F0, 0xECC5,
0x354F, 0x6C7A, 0x8725, 0xDE10, 0x08AE, 0x519B, 0xBAC4, 0xE3F1,
0x4E8D, 0x17B8, 0xFCE7, 0xA5D2, 0x736C, 0x2A59, 0xC106, 0x9833,
0xC2CB, 0x9BFE, 0x70A1, 0x2994, 0xFF2A, 0xA61F, 0x4D40, 0x1475,
0xB909, 0xE03C, 0x0B63, 0x5256, 0x84E8, 0xDDDD, 0x3682, 0x6FB7,
0x8372, 0xDA47, 0x3118, 0x682D, 0xBE93, 0xE7A6, 0x0CF9, 0x55CC,
0xF8B0, 0xA185, 0x4ADA, 0x13EF, 0xC551, 0x9C64, 0x773B, 0x2E0E,
0x74F6, 0x2DC3, 0xC69C, 0x9FA9, 0x4917, 0x1022, 0xFB7D, 0xA248,
0x0F34, 0x5601, 0xBD5E, 0xE46B, 0x32D5, 0x6BE0, 0x80BF, 0xD98A,
0x6A9E, 0x33AB, 0xD8F4, 0x81C1, 0x577F, 0x0E4A, 0xE515, 0xBC20,
0x115C, 0x4869, 0xA336, 0xFA03, 0x2CBD, 0x7588, 0x9ED7, 0xC7E2,
0x9D1A, 0xC42F, 0x2F70, 0x7645, 0xA0FB, 0xF9CE, 0x1291, 0x4BA4,
0xE6D8, 0xBFED, 0x54B2, 0x0D87, 0xDB39, 0x820C, 0x6953, 0x3066,
0xDCA3, 0x8596, 0x6EC9, 0x37FC, 0xE142, 0xB877, 0x5328, 0x0A1D,
0xA761, 0xFE54, 0x150B, 0x4C3E, 0x9A80, 0xC3B5, 0x28EA, 0x71DF,
0x2B27, 0x7212, 0x994D, 0xC078, 0x16C6, 0x4FF3, 0xA4AC, 0xFD99,
0x50E5, 0x09D0, 0xE28F, 0xBBBA, 0x6D04, 0x3431, 0xDF6E, 0x865B,
0x5FD1, 0x06E4, 0xEDBB, 0xB48E, 0x6230, 0x3B05, 0xD05A, 0x896F,
0x2413, 0x7D26, 0x9679, 0xCF4C, 0x19F2, 0x40C7, 0xAB98, 0xF2AD,
0xA855, 0xF160, 0x1A3F, 0x430A, 0x95B4, 0xCC81, 0x27DE, 0x7EEB,
0xD397, 0x8AA2, 0x61FD, 0x38C8, 0xEE76, 0xB743, 0x5C1C, 0x0529,
0xE9EC, 0xB0D9, 0x5B86, 0x02B3, 0xD40D, 0x8D38, 0x6667, 0x3F52,
0x922E, 0xCB1B, 0x2044, 0x7971, 0xAFCF, 0xF6FA, 0x1DA5, 0x4490,
0x1E68, 0x475D, 0xAC02, 0xF537, 0x2389, 0x7ABC, 0x91E3, 0xC8D6,
0x65AA, 0x3C9F, 0xD7C0, 0x8EF5, 0x584B, 0x017E, 0xEA21, 0xB314 ]
-- | Compute our standard checksum
--
checksum :: [Word8] -> Word16
checksum msg =
let
update :: Word16 -> Word8 -> Word16
update reg byte = (reg `shiftL` 8) `xor`
crcTable ! ((fromIntegral (reg `shiftR` 8)) `xor` byte)
in
foldl' update 0 msg
-- | Tests
--
instance Arbitrary Word8 where
arbitrary =
do n <- choose ((fromIntegral (minBound :: Word8)) :: Int,
(fromIntegral (maxBound :: Word8)) :: Int)
return (fromIntegral n)
coarbitrary v = variant 0 . coarbitrary v
prop_checksum xs = checksum (xs ++ splitWord (checksum xs)) == 0
where types = xs :: [Word8]
testOpts = TestOptions {no_of_tests = 1000,
length_of_tests = 3600,
debug_tests = True}
batch = do
result <- run prop_checksum testOpts
case result of
TestOk _ i _ -> putStrLn ("test ok: " ++ show i)
TestExausted _ i _ -> putStrLn ("test exhausted: " ++ show i)
TestFailed strs i -> putStrLn ("test failed: " ++ concat strs)
TestAborted ex -> putStrLn ("test aborted: " ++ show ex)
main = batch
When invoked under ghci, the main function in the module above does not always fail at the same point. For example, my most recent run of the above gave:
57:
[61,48,20]
58:
[80,90,202,253,203,52,183]
59:
[]
60:
[170,171,181,63,181,52,179,117]
61:
[56test aborted: <<loop>>
*Main>
Trac metadata
Trac field | Value |
---|---|
Version | 6.6 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | MacOS X |
Architecture | powerpc |