This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/51459] [4.7 Regression] 'double free or corruption' involving std::function and lambdas
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 08 Dec 2011 11:55:48 +0000
- Subject: [Bug c++/51459] [4.7 Regression] 'double free or corruption' involving std::function and lambdas
- Auto-submitted: auto-generated
- References: <bug-51459-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51459
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-08 11:55:48 UTC ---
Indeed, with 4.6.x preprocessed source for the reduced testcase this started
failing with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175158 aka
PR43912.
The only important difference at *.gimple level (except for renaming arguments
and similar debug info only related changes) seems to be:
-animate(F) [with F = std::function<void()>]::<lambda()> (const struct
__lambda0 * this)
+animate(F) [with F = std::function<void()>]::<lambda()> (const struct
__lambda0 * __closure)
{
- const struct function * D.9363;
+ const struct function * D.9367;
+ const struct function * D.9368;
+ const struct function f [value-expr: __closure->__f];
- D.9363 = &this->__f;
- std::function<void()>::operator() (D.9363);
+ try
+ {
+ D.9367 = &__closure->__f;
+ std::function<void()>::operator() (D.9367);
+ }
+ finally
+ {
+ D.9368 = &__closure->__f;
+ std::function<void()>::~function (D.9368);
+ }
}
so before this change __closure->__f wouldn't be destructed, now it is, and
supposedly it is destructed in the caller too.