Bug 17977 - C++ emits multiple dtor-calling functions for one definition
Summary: C++ emits multiple dtor-calling functions for one definition
Status: RESOLVED DUPLICATE of bug 17976
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-13 18:40 UTC by Michael Matz
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host: x86-linux
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Matz 2004-10-13 18:40:32 UTC
This came over from #17937.  The testcase 
------------------------------------------- 
#include <string> 
std::string idl_filename; 
extern std::string idl_filename; 
int main() 
{ 
        idl_filename = "bla"; 
        return 0; 
} 
------------------------------------------- 
segfaults when compiled with "g++ -pthread test.cc". 
 
The reason is that there are two destroyer functions for "idl_filename" 
registered (__tcf_2 and __tcf_1).  This happens only if the "extern" 
declaration comes after the definition.
Comment 1 Andrew Pinski 2004-10-13 18:42:41 UTC
I filed one with a self contained example.

*** This bug has been marked as a duplicate of 17976 ***