From 68c5b1225572ecf2c52baf62f928063e5a30511b Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Tue, 9 Aug 2016 22:58:44 -0400 Subject: [PATCH] fix #22 segfault printing stack trace for error during evaluation of argument default values --- flisp.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flisp.c b/flisp.c index dd752c3..f5c3f8d 100644 --- a/flisp.c +++ b/flisp.c @@ -1991,7 +1991,13 @@ static value_t _stacktrace(uint32_t top) &vector_elt(Stack[bp+1],0), (sz-1)*sizeof(value_t)); } else { - memcpy(&vector_elt(v,0), &Stack[bp], sz*sizeof(value_t)); + uint32_t i; + for(i=0; i < sz; i++) { + value_t si = Stack[bp+i]; + // if there's an error evaluating argument defaults some slots + // might be left set to UNBOUND (issue #22) + vector_elt(v,i) = (si == UNBOUND ? FL_UNSPECIFIED : si); + } } lst = fl_cons(v, lst); top = Stack[top-4];