------- Additional Comments From bangerth at dealii dot org 2005-01-28 01:08 ------- Confirmed, although I consider this to be a rather minor point since the code is actually run only once. Here's a small test: -------------------- struct A { A(); ~A() {} }; void foo () { static A a; } ------------------------- g/x> /home/bangerth/bin/gcc-4.0-pre/bin/c++ -S -O3 x.cc g/x> cat x.s | c++filt > x.ss .... foo(): .LFB5: pushl %ebp .LCFI2: movl %esp, %ebp .LCFI3: pushl %ebx .LCFI4: subl $20, %esp .LCFI5: cmpb $0, guard variable for foo()::a je .L12 .L9: addl $20, %esp popl %ebx popl %ebp ret .p2align 4,,7 .L12: movl guard variable for foo()::a, (%esp) call __cxa_guard_acquire testl %eax, %eax je .L9 movl foo()::a, (%esp) .LEHB0: call A::A() .LEHE0: movl guard variable for foo()::a, (%esp) call __cxa_guard_release movl $__tcf_0, (%esp) call atexit addl $20, %esp popl %ebx popl %ebp ret ... W.
-- What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Status|UNCONFIRMED |NEW Ever Confirmed| |1 Last reconfirmed|0000-00-00 00:00:00 |2005-01-28 01:08:27 date| | Summary|many redundant atexit calls |unnecessary atexit calls |emitted into the executable |emitted for static objects |for static objects with |with empty destructors |empty destructors | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19661