From 371e92c448bbaa98f9bd88149bf171863161de10 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 20 Aug 2002 17:21:32 +0000 Subject: [PATCH] finally fix chained function calls /properly/. need to make sure /all/ args get their user count incremented, not just the head of the chain --- tools/qfcc/source/expr.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 26fbc361e..97a2cde73 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -1685,12 +1685,16 @@ function_expr (expr_t *e1, expr_t *e2) } else { *a = e; } + // new_binary_expr calls inc_users for both args, but in_users doesn't + // walk expression chains so only the first arg expression in the chain + // (the last arg in the call) gets its user count incremented, thus + // ensure all other arg expressions get their user counts incremented. + if (a != &args) + inc_users (*a); a = &(*a)->next; } for (i = 0; i < arg_expr_count - 1; i++) { append_expr (call, assign_expr (arg_exprs[i][1], arg_exprs[i][0])); - e = arg_exprs[i][1]; - inc_users (e); } if (arg_expr_count) { e = new_bind_expr (arg_exprs[arg_expr_count - 1][0],