The attached test case involves a global object with class type and a constructor that just copies values from its arguments into instance variables. It would be nice if GCC would recognize this case and generate an initialized-data object instead of a global constructor invocation. (In this particular example, the entire object could then go into .rodata; but the optimization would be beneficial even for objects that can't.)
-- Summary: optimize static constructors into initialized data Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: zackw at panix dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30023