From eb867a95a07084553520803c70fa4894d276c37c Mon Sep 17 00:00:00 2001 From: Isaiah Norton Date: Sat, 22 Aug 2015 10:50:38 -0400 Subject: [PATCH] Add missing GC roots in ast.c --- src/ast.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/src/ast.c b/src/ast.c index df0feb616f745..101b32a023592 100644 --- a/src/ast.c +++ b/src/ast.c @@ -327,34 +327,48 @@ static jl_value_t *scm_to_julia_(value_t e, int eo) e = cdr_(e); if (!eo) { if (sym == line_sym && n==2) { - jl_value_t *filename = scm_to_julia_(car_(cdr_(e)),0); - jl_value_t *linenum = scm_to_julia_(car_(e),0); + jl_value_t *filename = NULL, *linenum = NULL; JL_GC_PUSH2(&filename, &linenum); + filename = scm_to_julia_(car_(cdr_(e)),0); + linenum = scm_to_julia_(car_(e),0); jl_value_t *temp = jl_new_struct(jl_linenumbernode_type, filename, linenum); JL_GC_POP(); return temp; } + jl_value_t *scmv = NULL, *temp = NULL; + JL_GC_PUSH(&scmv); if (sym == label_sym) { - return jl_new_struct(jl_labelnode_type, - scm_to_julia_(car_(e),0)); + scmv = scm_to_julia_(car_(e),0); + temp = jl_new_struct(jl_labelnode_type, scmv); + JL_GC_POP(); + return temp; } if (sym == goto_sym) { - return jl_new_struct(jl_gotonode_type, - scm_to_julia_(car_(e),0)); + scmv = scm_to_julia_(car_(e),0); + temp = jl_new_struct(jl_gotonode_type, scmv); + JL_GC_POP(); + return temp; } if (sym == inert_sym || (sym == quote_sym && (!iscons(car_(e))))) { - return jl_new_struct(jl_quotenode_type, - scm_to_julia_(car_(e),0)); + scmv = scm_to_julia_(car_(e),0); + temp = jl_new_struct(jl_quotenode_type, scmv); + JL_GC_POP(); + return temp; } if (sym == top_sym) { - return jl_new_struct(jl_topnode_type, - scm_to_julia_(car_(e),0)); + scmv = scm_to_julia_(car_(e),0); + temp = jl_new_struct(jl_topnode_type, scmv); + JL_GC_POP(); + return temp; } if (sym == newvar_sym) { - return jl_new_struct(jl_newvarnode_type, - scm_to_julia_(car_(e),0)); + scmv = scm_to_julia_(car_(e),0); + temp = jl_new_struct(jl_newvarnode_type, scmv); + JL_GC_POP(); + return temp; } + JL_GC_POP(); } else if (sym == inert_sym && !iscons(car_(e))) { sym = quote_sym;