-fPIC -Os generates redundant stack frame

Bug #1927055 reported by Ralph Mimms
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GNU Arm Embedded Toolchain
New
Undecided
Unassigned

Bug Description

example: https://godbolt.org/z/rYxTPdTcd

gcc versions after 4 (>= 5) generate a redundant stack frame as can be seen in the attached example, while gcc version 4 generates correct code that is also minimal in size as requested (-Os).

The code generation in newer gcc versions is strange even without thinking about the -Os, since the generates stack frame is not even used, and the whole 3 instructions (sub sp, str, add sp) are totally not needed (the variable on the stack is not used).

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.