This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19661] unnecessary atexit calls emitted for static objects with empty destructors
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2005 01:08:28 -0000
- Subject: [Bug c++/19661] unnecessary atexit calls emitted for static objects with empty destructors
- References: <20050127222428.19661.yuri@tsoft.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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