[Bug c++/12747] New: GCC generates poor code for temporary structs
jbuck at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Oct 23 18:12:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12747
Summary: GCC generates poor code for temporary structs
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Keywords: pessimizes-code
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jbuck at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
This problem has been discussed for a decade, but I couldn't find a clear example
in the Bugzilla database, so here is one.
In this example we have a simple C++ bit vector class. operator[] is overloaded
in the usual way, to return a proxy object, so that C-like array notation can be
used. However, the code sucks: typically we wind up with many dead stores to
the stack. The example includes two routines: copy, which uses the operator[],
and copy_2, which directly calls getBit and setBit. The compiler should be able
to generate equally good code for copy and copy_2.
More information about the Gcc-bugs
mailing list