From 3ebc2e9bd947aa213f2bc5eaf19fe9ffc8f9b5ca Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Mon, 16 Jan 2023 15:35:11 +0100 Subject: Disable tail calls in variadic functions Variadic functions can use the stack frame to store values of registers. Hence, a pointer within the stack frame can be put in a va_list, and the stack frame should not be deallocated before a function call that may use this va_list. Fixes: #473 --- backend/Tailcall.v | 1 + 1 file changed, 1 insertion(+) (limited to 'backend/Tailcall.v') diff --git a/backend/Tailcall.v b/backend/Tailcall.v index b7a62d74..2da07ee8 100644 --- a/backend/Tailcall.v +++ b/backend/Tailcall.v @@ -93,6 +93,7 @@ Definition transf_instr (f: function) (pc: node) (instr: instruction) := Definition transf_function (f: function) : function := if zeq f.(fn_stacksize) 0 + && option_eq zeq f.(fn_sig).(sig_cc).(cc_vararg) None then RTL.transf_function (transf_instr f) f else f. -- cgit