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

            Bug ID: 90216
           Summary: Stack Pointer decrementing even when not loading extra
                    data to stack.
           Product: gcc
           Version: 8.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stevexiong98 at hotmail dot com
  Target Milestone: ---

Hi,

Using ARM GCC 8.2, when I instantiate an object the corresponding Assembly
instructions involve a decrementing, then incrementing of the stack pointer.
However, no values are being transferred between the registers and the empty
stack space. 

Please check out this link for details, lines 5 and 7 in the Assembly panel
show how the stack pointer is decremented/incremented unnecessarily.

https://godbolt.org/z/h-H7Ox

In the C++ panel when you comment out line 53 and uncomment the line below, the
Assembly instructions involving the stack pointer disappear. The same is true
if you uncomment just line 55.

Can you please explain why the stack pointer inc/dec operations are not
optimized out in the first line of code (line 53)? Can you please try to
release a patch where this unnecessary stack pointer inc/dec is no longer an
issue?

Thanks

Reply via email to