On Wed, Apr 18, 2018 at 4:59 AM, Kito Cheng <kito.ch...@gmail.com> wrote: + HOST_WIDE_INT min_first_step = + RISCV_STACK_ALIGN (frame->total_size - frame->fp_sp_offset); + HOST_WIDE_INT max_first_step = + ROUND_DOWN (IMM_REACH / 2 - PREFERRED_STACK_BOUNDARY / 8, + PREFERRED_STACK_BOUNDARY / 8); + HOST_WIDE_INT min_second_step = + RISCV_STACK_ALIGN (frame->total_size - max_first_step);
IMM_REACH and PREFERRED_STACK_BOUNDARY are aligned values, so I don't see the point of rounding max_first_step. Similarly, frame->total_size and max_first_step are aligned values, so I don't see the point of rounding min_second_step. I do see that rounding min_first_step is useful. I'd like to add just that one statement change unless you have a reason for the others. I tested this with the following + if (min_first_step != RISCV_STACK_ALIGN (min_first_step)) + abort (); + if (max_first_step != RISCV_STACK_ALIGN (max_first_step)) + abort (); + if (min_second_step != RISCV_STACK_ALIGN (min_second_step)) + abort (); doing 32/64 elf/linux cross builds and testsuite runs. It failed for a 32-bit target before I rounded min_first_step. With that one change, I saw no further failures. Jim