This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/19661] unnecessary atexit calls emitted for static objects with empty destructors


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]