compiling the following ------start-code-------- struct X { void g(); };
void g(); void f() { X x; x.g(); g(); } ------end-code--------- yields (with -O2) subl $24, %esp in the prologue. without the empty class only 12 bytes are subtracted, presumably to preserve stack alignment. this is wasteful of stack space. -- Summary: excessive stack use for automatic object on stack Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: avi at argo dot co dot il GCC build triplet: x86_64-redhat-linux GCC host triplet: x86_64-redhat-linux GCC target triplet: i386-redhat-linux (with -m32) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27312