1 Apr 2011 01:22
#5071: GHCi crashes on large alloca/allocaBytes requests
GHC <cvs-ghc <at> haskell.org>
2011-03-31 23:22:12 GMT
2011-03-31 23:22:12 GMT
#5071: GHCi crashes on large alloca/allocaBytes requests
---------------------------------+------------------------------------------
Reporter: guest | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.0.3 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
GHCi, and ghc, seems to exit (crash?) on certain types of memory
allocation exceptions.
The FFI addendum says that the allocation functions should be able to
return null:
http://www.cse.unsw.edu.au/~chak/haskell/ffi/ffi/ffise5.html#x8-230005
Section 5.8 says this:
> If any of the allocation functions fails, a value of Ptr.nullPtr is
produced. If free or reallocBytes is applied to a memory area that has
been allocated with alloca or allocaBytes, the behaviour is undefined. Any
further access to memory areas allocated with alloca or allocaBytes, after
the computation that was passed to the allocation function has terminated,
leads to undefined behaviour. Any further access to the memory area
referenced by a pointer passed to realloc, reallocBytes, or free entails
undefined behaviour.
In practice, code examples and documentation appear to rely on `alloca`
'''NOT''' returning a `nullPtr`:
(Continue reading)
RSS Feed