Unnecessary push/pop
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_
}
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.
Thanks for the report. At first glance it looks like a CMSIS bug - will confirm shortly.