id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	os	architecture	failure	difficulty	testcase	blockedby	blocking	related
4906	peekCString crashes on handling nullPtr	sdjp		"
Not quite sure what the 'correct' behaviour here is; but here's a minimal test case:


{{{
-bash-3.2$ more TestCase.hs
import Foreign
import Foreign.C

main = do
    str <- peekCString nullPtr
    putStrLn str

-bash-3.2$ ghc --make TestCase.hs 
-bash-3.2$ ./TestCase 
Segmentation fault

}}}

I was not expecting a seg fault here.  At minimum, peekCString documentation should describe what is meant to happen when you pass it a nullPtr (currently not mentioned at all).  Better would be some form of error reporting - I'm integrating with a C library, and it took me a while to track down what the root cause of the seg fault was.
"	bug	closed	normal		Compiler (FFI)	6.12.3	invalid			Linux	x86_64 (amd64)	Runtime crash					
