Commit 22740413 authored by Simon Marlow's avatar Simon Marlow

add test for pointer alignment

parent 4830921a
import Foreign
import Control.Monad
-- check that all pointers returned by allocaBytes and mallocBytes are
-- 16-byte aligned
main = do
xs <- sequence [ allocaBytes x $ return | x <- [1..500] ]
ys <- mapM mallocBytes [1..500]
when (not $ all ((==0) . (.&. 15) . (`minusPtr` nullPtr)) (xs ++ ys)) $ do
print xs
print ys
......@@ -134,3 +134,6 @@ test('fptr01', [ omit_ways(['ghci']), extra_clean(['fptr01_c.o']) ],
test('fptrfail01', [ compose(omit_ways(['ghci']), exit_code(1)),
extra_clean(['fptrfail01_c.o']) ],
compile_and_run, ['fptrfail01_c.c'])
test('2917a', 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