#5071: GHCi crashes on large alloca/allocaBytes requests
---------------------------------+------------------------------------------
    Reporter:  guest             |        Owner:              
        Type:  bug               |       Status:  new         
    Priority:  normal            |    Milestone:              
   Component:  Compiler          |      Version:  7.0.3       
    Keywords:                    |     Testcase:              
   Blockedby:                    |   Difficulty:              
          Os:  Unknown/Multiple  |     Blocking:              
Architecture:  Unknown/Multiple  |      Failure:  None/Unknown
---------------------------------+------------------------------------------

Comment(by simonmar):

 Replying to [comment:6 guest]:
 > I don't know if Haskell's `alloca` was intended to behave like C's
 `alloca`

 Only in the sense that it deallocates automatically when exiting the
 scope.

 > What initially attracted me to using `alloca` is that I thought it was
 equivalent to the pseudo-code: `bracket malloc free`.

 Yes, that's the idea - indeed, that's the reference implementation.

 >  Perhaps I had the wrong expectation and the FFI should be amended to
 say that `alloca` requests for too many bytes are undefined like the C
 variant?

 I can't think of any good reason to make the behaviour undefined, that
 would be worse than both of the other designs (`nullPtr` and exception).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5071#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to