Commit 2cf530f2 authored by simonmar's avatar simonmar
Browse files

[project @ 2006-01-09 10:29:44 by simonmar]

add a cmm lint failure
parent fbdb45e4
......@@ -2,3 +2,4 @@ test('cg001', only_compiler_types(['ghc']), compile, [''])
test('cg002', normal, compile, [''])
test('cg003', only_ways(['opt']), compile, ['-fvia-C'])
test('cg004', normal, compile, [''])
test('cg005', only_ways(['opt']), compile, [''])
module Bug where
import Foreign
import Foreign.ForeignPtr
import Data.Char
data PackedString = PS !(ForeignPtr Word8) !Int !Int
(!) :: PackedString -> Int -> Word8
(PS x s _l) ! i
= unsafePerformIO $ withForeignPtr x $ \p -> peekElemOff p (s+i)
w2c :: Word8 -> Char
w2c = chr . fromIntegral
indexPS :: PackedString -> Int -> Char
indexPS theps i | i < 0 = error "Negative index in indexPS"
| otherwise = w2c $ theps ! i
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