public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/95941] New: Passing a struct by value wastes 16 bytes on the stack
@ 2020-06-27 16:44 josephcsible at gmail dot com
2020-06-29 10:36 ` [Bug target/95941] " rguenth at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: josephcsible at gmail dot com @ 2020-06-27 16:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95941
Bug ID: 95941
Summary: Passing a struct by value wastes 16 bytes on the stack
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: josephcsible at gmail dot com
Target Milestone: ---
Target: x86_64-linux-gnu
Consider this C code:
extern struct foo {
long x, y, z;
} s;
void f(struct foo);
void g(void) {
f(s);
}
At "-O3", it compiles to this:
g:
subq $16, %rsp
pushq s+16(%rip)
pushq s+8(%rip)
pushq s(%rip)
call f
addq $40, %rsp
ret
There's no reason at all to use that extra 16 bytes of stack space. It should
have compiled to this instead:
g:
pushq s+16(%rip)
pushq s+8(%rip)
pushq s(%rip)
call f
addq $24, %rsp
ret
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/95941] Passing a struct by value wastes 16 bytes on the stack
2020-06-27 16:44 [Bug target/95941] New: Passing a struct by value wastes 16 bytes on the stack josephcsible at gmail dot com
@ 2020-06-29 10:36 ` rguenth at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-06-29 10:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95941
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2020-06-29
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed. ISTR a very recent duplicate.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-06-29 10:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-27 16:44 [Bug target/95941] New: Passing a struct by value wastes 16 bytes on the stack josephcsible at gmail dot com
2020-06-29 10:36 ` [Bug target/95941] " rguenth at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).