From 3e5fba812749b9240b655a99809e62231d1145aa Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 5 Feb 2020 18:31:20 +0100 Subject: Incorrect computation of extra stack size for vararg calls in RISC-V (#213) Currently, the extra size for the variable arguments is too small for the 64 bit RISC-V and the extra arguments are stored in the wrong stack slots. --- riscV/Asmexpand.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'riscV/Asmexpand.ml') diff --git a/riscV/Asmexpand.ml b/riscV/Asmexpand.ml index 3e734747..1df63308 100644 --- a/riscV/Asmexpand.ml +++ b/riscV/Asmexpand.ml @@ -483,7 +483,7 @@ let expand_instruction instr = emit (Pmv (X30, X2)); if sg.sig_cc.cc_vararg then begin let n = arguments_size sg in - let extra_sz = if n >= 8 then 0 else align 16 ((8 - n) * wordsize) in + let extra_sz = if n >= 8 then 0 else align ((8 - n) * wordsize) 16 in let full_sz = Z.add sz (Z.of_uint extra_sz) in expand_addptrofs X2 X2 (Ptrofs.repr (Z.neg full_sz)); expand_storeind_ptr X30 X2 ofs; @@ -501,7 +501,7 @@ let expand_instruction instr = let extra_sz = if sg.sig_cc.cc_vararg then begin let n = arguments_size sg in - if n >= 8 then 0 else align 16 ((8 - n) * wordsize) + if n >= 8 then 0 else align ((8 - n) * wordsize) 16 end else 0 in expand_addptrofs X2 X2 (Ptrofs.repr (Z.add sz (Z.of_uint extra_sz))) -- cgit