Unnecessary push/pop

Bug #1660947 reported by Leo Havmøller
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
Fix Released
Undecided
Unassigned

Bug Description

gcc: Unnecessary push/pop.

Version information
-------------------
New for 2016q4.
Not seen with (randomly selected) older versions: 2014q2, 2015q2, 2015q3, 2015q4, 2016q1, 2016q2, 2016q3.
Using pre-built Windows binaries.

Demonstration example
---------------------
test.bat compiles file.c with the above compiler versions, and generates listingNN.txt for each.
listing1.txt through listing7.txt are for the older compiler versions.
listing8.txt it for 2016q4 and shows the issue.

Example function
----------------
void RsSpInit(void)
{
  __set_MSP((uintptr_t)&_CSTACK_START);
}

Assembler listing7.txt
----------------------
RsSpInit:
 ldr r3, .L2
 MSR msp, r3
 bx lr

Assembler listing8.txt
----------------------
RsSpInit:
 push {r7, lr}
 ldr r3, .L2
 add r7, sp, #0
 MSR msp, r3
 mov sp, r7
 pop {r7, pc}

The additonal opush/pop would normally just be extra code, but since this function actually
changes the stack pointer, the code does not behave correctly.

EOF.

Revision history for this message
Leo Havmøller (leh-p) wrote :
Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

Thanks for the report. At first glance it looks like a CMSIS bug - will confirm shortly.

Revision history for this message
Leo Havmøller (leh-p) wrote :

I updated to CMSIS-SP-00300-r4p5-00rel0 (the latest I could find) before posting.

Revision history for this message
Tejas Belagod (belagod-tejas) wrote :

This bug has now been fixed on https://github.com/ARM-software/CMSIS_5.

Changed in gcc-arm-embedded:
status: New → Fix Committed
Revision history for this message
Thomas Preud'homme (thomas-preudhomme) wrote :

This has been fixed in CMSIS 5.0.1

Changed in gcc-arm-embedded:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.