This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/19661] unnecessary atexit calls emitted for static objects with empty destructors
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 28 Jan 2005 18:53:46 -0000
- Subject: [Bug middle-end/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 pinskia at gcc dot gnu dot org 2005-01-28 18:53 -------
(In reply to comment #5)
> I'll move this bug back to the C++ component.
Consider the following C++ code:
struct Foo { ~Foo() {} int i; };
struct A { Foo foo[2]; };
void foo () {
static A a;
}
We don't know the deconstructor for A is empty until we remove the empry loop and do optimizations
on it. So this is again a job for the midde-end/tree-optimizations. We can then mark the function as
empty and then have a pass (or really fold or something like that) remove calls to atexit (and similar
functions) which just references empty functions. This is the correct way of doing this.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |middle-end
GCC build triplet|n/a |
GCC target triplet|n/a |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19661