https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64453

            Bug ID: 64453
           Summary: Live high register not saved in function prolog on ARM
                    with -Os
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thopre01 at gcc dot gnu.org

When compiling for size, live high registers are not saved in function prolog
for ARM target. The following testcase can reproduce the problem:

void save_regs () {
  __asm volatile ("" ::: "r7", "r8");
}

Compiling with arm-none-eabi-gcc -c -Os -mcpu=cortex-m0 -mthumb will only save
r7 on the stack. Using -fcall-saved-r8 does not help.

The problem comes from arm_conditional_register_usage setting call_used_regs
for all high register to avoid them being allocated. However, this cause prolog
to not save these register even if they are used.

Reply via email to