multiple destructor calls of static objects

Peter A. Felvegi petschy@praire-chicken.com
Tue Jan 24 15:57:00 GMT 2012


Hello,

I ran into a bug with 4.6, when implementing a custom rtti framework, on 
an Amd64 Debian Wheezy box. It seems that at certain optimization 
levels, dtors of static objects are called multiple times. Attached a 
test case. It will print 'DEADBEEF' when the bug is hit. Searched 
bugzilla for "multiple destructor call", but found nothing relevant. The 
bug appears with only 4.6.x, and only at -O2, 3 and s.

Tested with:
* gcc-4.4.7 20111231 (prerelease) (GCC), compiled from source
* gcc-4.5.3, stock debian wheezy
* gcc-4.6.2, stock debian wheezy
* gcc-4.6.3 20120120 (prerelease) (GCC), compiled from source
* gcc-4.7.0 20120104 (experimental) (GCC), compiled from source

Should I file a bugreport and / or search for the commit that introduced 
the bug?

Regards, Peter


-------------- next part --------------
A non-text attachment was scrubbed...
Name: gccmultdtor.cpp
Type: text/x-c++src
Size: 1086 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20120124/f7a9c9bc/attachment.bin>


More information about the Gcc mailing list