Compilling: ./g++ -O2 ~/mozalloc.ii -S -m32 gives me: .type _GLOBAL__I_moz_free, @function _GLOBAL__I_moz_free: .LFB58: .cfi_startproc rep ret .cfi_endproc .LFE58: .size _GLOBAL__I_moz_free, .-_GLOBAL__I_moz_free .section .ctors,"aw",@progbits .align 4 .long _GLOBAL__I_moz_free .local _ZN7mozillaL8fallibleE .comm _ZN7mozillaL8fallibleE,1,1
I.e. an empty constructor function that can be eliminated and also local var _ZN7mozillaL8fallibleE that is not used at all. The reason is that constructor in .optimized stage looks like: (static initializers for /mozilla-central/memory/mozalloc/mozalloc.cpp) () { <bb 2>: fallible = {}; return; } that later expands to nothing. If we optimized this away during early opts I already have patch that makes it easy to eliminate all global ctors/dtors that are known to be pure. Honza -- Summary: Stores expanding to no RTL not removed by tree optimizers, Empty ctors/dtors not eliminated Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hubicka at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45307