[pure-lang-svn] SF.net SVN: pure-lang:[465] pure/trunk
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-08-11 19:07:46
|
Revision: 465
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=465&view=rev
Author: agraef
Date: 2008-08-11 19:07:48 +0000 (Mon, 11 Aug 2008)
Log Message:
-----------
Fix segfault in catch/throw.
Modified Paths:
--------------
pure/trunk/ChangeLog
pure/trunk/runtime.cc
Modified: pure/trunk/ChangeLog
===================================================================
--- pure/trunk/ChangeLog 2008-08-11 10:26:44 UTC (rev 464)
+++ pure/trunk/ChangeLog 2008-08-11 19:07:48 UTC (rev 465)
@@ -1,5 +1,8 @@
2008-08-11 Albert Graef <Dr....@t-...>
+ * runtime.cc (pure_catch): Fix wrong stack cleanup, causing
+ segfaults with catch/throw. Reported by Libor Spacek.
+
* configure.ac, Makefile.in: Additional configury for proper
handling of dynamic linking on OSX (-install_name option,
DYLD_LIBRARY_PATH). Reported by Ryan Schmidt. NOTE: This change
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-08-11 10:26:44 UTC (rev 464)
+++ pure/trunk/runtime.cc 2008-08-11 19:07:48 UTC (rev 465)
@@ -1299,9 +1299,10 @@
size_t m = x->data.clos->m;
assert(x->data.clos->local || m == 0);
pure_expr **env = 0;
+ size_t oldsz = interp.sstk_sz;;
if (m>0) {
// construct a stack frame
- size_t sz = interp.sstk_sz;;
+ size_t sz = oldsz;
resize_sstk(interp.sstk, interp.sstk_cap, sz, m+1);
pure_expr **sstk = interp.sstk; env = sstk+sz+1;
sstk[sz++] = 0;
@@ -1324,7 +1325,7 @@
}
checkstk(test);
// Push an exception.
- pure_exception ex; ex.e = 0; ex.sz = interp.sstk_sz;
+ pure_exception ex; ex.e = 0; ex.sz = oldsz;
interp.estk.push_front(ex);
// Call the function now. Catch exceptions generated by the runtime.
if (setjmp(interp.estk.front().jmp)) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|