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.

-- 
           Summary: C++ emits multiple dtor-calling functions for one
                    definition
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matz at suse dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: x86-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17977

Reply via email to