diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-16 13:14:36 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-16 13:28:44 -0400 |
commit | f8a754eb192bc8fae9ff21da07f06c07d295ebc0 (patch) | |
tree | 25c2fc79fd0d8d293cf22400b62443f92aaf84ff | |
parent | f1c409f77d453878f41a2acc066eaba396333156 (diff) |
Fix arguments being freed to early
Moved freeing argument tree into function/procedure parsing not
parameter list parsing (in update_types), so function/procedure could set parameter types
correctly.
-rw-r--r-- | pc.y | 4 | ||||
-rw-r--r-- | tree.c | 1 |
2 files changed, 4 insertions, 1 deletions
@@ -98,6 +98,7 @@ program set_ret_type($9); print_tree($9); free_tree($9); + free_tree($4); #ifdef DEBUG print_scope(cur_scope); #endif @@ -129,6 +130,7 @@ var_declarations :var_declarations VAR id_list ':' type ';' { update_type_info($3, $5); + free_tree($3); } |/*empty*/ ; @@ -195,6 +197,7 @@ sub_prog_head assert(tmp->func_info->argv = malloc(i * sizeof(int))); assert(!set_func_types($3, tmp->func_info->argv, i)); + free_tree($3); tmp->var_type = $5; @@ -217,6 +220,7 @@ sub_prog_head assert(tmp->func_info->argv = malloc(i * sizeof(int))); assert(!set_func_types($3, tmp->func_info->argv, i)); + free_tree($3); } ; @@ -101,7 +101,6 @@ ptree *list, *t; break; /*At _end_ of list (did not continue)*/ } - free_tree(list); return; } |