aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-25 15:27:17 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2022-06-27 12:12:49 +0200
commitec2e9b554d4799633ff195106280a8146647db5b (patch)
treedaec3ab1ed894a8e647848b62f8ebfaf05b2bb21
parentfd3f7de6113aebe927d9bfff0f485e48a6edf68e (diff)
downloadsparse-dev-ec2e9b554d4799633ff195106280a8146647db5b.tar.gz
inline: declaration of the variadic vars is useless
When inlining a function call, the arguments of this call must somehow be assigned to the names used in the function definition. This is done via a STMT_DECLARATION associated to the top STMT_COMPOUND which now correspond to the inlined code. This is perfectly fine for the normal case of non-variadic function but when inlining a variadic function there is no corresponding name to assign the non-fixed arguments to (such arguments must either be not used at all or copied via __builtin_va_arg_pack()). What's then happening is essentially that these variables are self-assigned. Not Good. This seems to be relatively harmless but is confusing. So only put the fixed/named arguments in the declaration list. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--inline.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/inline.c b/inline.c
index d031c9b1..4696eb50 100644
--- a/inline.c
+++ b/inline.c
@@ -546,14 +546,14 @@ int inline_function(struct expression *expr, struct symbol *sym)
*a = *name;
set_replace(name, a);
add_symbol(&fn_symbol_list, a);
+ a->initializer = arg;
+ add_symbol(&arg_decl, a);
} else {
// This may create a node of a node but it will
// be resolved later when the corresponding
// STMT_DECLARATION will be evaluated.
a->ctype.base_type = arg->ctype;
}
- a->initializer = arg;
- add_symbol(&arg_decl, a);
NEXT_PTR_LIST(name);
} END_FOR_EACH_PTR(arg);