From 361292be13045d2ed2812b26bb6c634b60e155df Mon Sep 17 00:00:00 2001 From: Chung-Ju Wu Date: Sun, 22 Apr 2018 08:25:47 +0000 Subject: [PATCH] [NDS32] Fix wrong input value of parameter from stack for variable-length function. gcc/ * config/nds32/nds32.c (nds32_compute_stack_frame): Fix wrong value. From-SVN: r259549 --- gcc/ChangeLog | 4 ++++ gcc/config/nds32/nds32.c | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7c6fb7631c0..43c1b3a3d55 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2018-04-22 Chung-Ju Wu + + * config/nds32/nds32.c (nds32_compute_stack_frame): Fix wrong value. + 2018-04-22 Chung-Ju Wu * config/nds32/nds32-protos.h (nds32_data_alignment, diff --git a/gcc/config/nds32/nds32.c b/gcc/config/nds32/nds32.c index a0012c0ccf3..0c4e91758b5 100644 --- a/gcc/config/nds32/nds32.c +++ b/gcc/config/nds32/nds32.c @@ -611,10 +611,12 @@ nds32_compute_stack_frame (void) { block_size = cfun->machine->fp_size + cfun->machine->gp_size - + cfun->machine->lp_size - + (4 * (cfun->machine->callee_saved_last_gpr_regno - - cfun->machine->callee_saved_first_gpr_regno - + 1)); + + cfun->machine->lp_size; + + if (cfun->machine->callee_saved_last_gpr_regno != SP_REGNUM) + block_size += (4 * (cfun->machine->callee_saved_last_gpr_regno + - cfun->machine->callee_saved_first_gpr_regno + + 1)); if (!NDS32_DOUBLE_WORD_ALIGN_P (block_size)) { -- 2.30.2