~ chicken-core (chicken-5) 44c2f63e04e1bca094f05f236e741c57071c844e
commit 44c2f63e04e1bca094f05f236e741c57071c844e Author: Jim Ursetto <zbigniewsz@gmail.com> AuthorDate: Fri Jan 13 00:00:22 2012 -0600 Commit: felix <felix@call-with-current-continuation.org> CommitDate: Sat Feb 18 13:19:03 2012 +0100 Use C_stack_pointer instead of C_alloc(0) when generating foreign callback stubs alloca(0) returns NULL in LLVM instead of returning the stack pointer, so generate a call to C_stack_pointer instead. This is only necessary when adjusting the callback stack, as all other calls to C_alloc are omitted when their size is 0. diff --git a/c-backend.scm b/c-backend.scm index c5c81e0b..f41c59b6 100644 --- a/c-backend.scm +++ b/c-backend.scm @@ -1114,7 +1114,8 @@ (when rname (gen #t "/* from " (cleanup rname) " */") ) (generate-foreign-callback-header "" stub) - (gen #\{ #t "C_word x,s=" sizestr ",*a=C_alloc(s);") + (gen #\{ #t "C_word x,s=" sizestr ",*a=" + (if (string=? "0" sizestr) "C_stack_pointer;" "C_alloc(s);")) (gen #t "C_callback_adjust_stack(a,s);") ; make sure content is below stack_bottom as well (for-each (lambda (v t)Trap