diff options
author | Bernhard Schommer <bschommer@users.noreply.github.com> | 2020-02-05 18:31:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 18:31:20 +0100 |
commit | 3e5fba812749b9240b655a99809e62231d1145aa (patch) | |
tree | f5e975aecc79251dc12df334c59c1dde12dd3db7 /riscV | |
parent | 39278439ad26cb5eb22b496066c0f044c33ef28b (diff) | |
download | compcert-3e5fba812749b9240b655a99809e62231d1145aa.tar.gz compcert-3e5fba812749b9240b655a99809e62231d1145aa.zip |
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.
Diffstat (limited to 'riscV')
-rw-r--r-- | riscV/Asmexpand.ml | 4 |
1 files changed, 2 insertions, 2 deletions
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))) |