aboutsummaryrefslogtreecommitdiffstats
path: root/backend/Tailcall.v
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2023-01-16 15:35:11 +0100
committerXavier Leroy <xavier.leroy@college-de-france.fr>2023-01-23 18:14:20 +0100
commit3ebc2e9bd947aa213f2bc5eaf19fe9ffc8f9b5ca (patch)
tree688882626c0b35d9bc20e5a965ebf4121971cfba /backend/Tailcall.v
parent800017c36c15774bdcc7dc5b318fa9606caa4170 (diff)
downloadcompcert-3ebc2e9bd947aa213f2bc5eaf19fe9ffc8f9b5ca.tar.gz
compcert-3ebc2e9bd947aa213f2bc5eaf19fe9ffc8f9b5ca.zip
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
Diffstat (limited to 'backend/Tailcall.v')
-rw-r--r--backend/Tailcall.v1
1 files changed, 1 insertions, 0 deletions
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.