From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3EFB93858410; Thu, 24 Nov 2022 09:41:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3EFB93858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669282872; bh=WyA7KnGIzgBdgoKzwlb5MmEXy5X79/hS6lBOxCZUS24=; h=From:To:Subject:Date:From; b=wykj1urkcTziD8UoebUfE+ixg4SAyABYkHSR491yRgx7/stMkWnT0TeHNJhCBNejd Q042puMPOofQ1ZEZEfEQkfEPl6FgI5wPOaI0t+3LRFcLY87cjW0wmXOhtDIMTyFSFD Z0ZiGjEVgTXt1bsyMm3lKaEITYK+RYfw3wyJtck0= From: "pg.ensiie at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/107857] New: recursive_mutex misses destructor if non-function call initialization is used Date: Thu, 24 Nov 2022 09:41:12 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 11.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: pg.ensiie at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107857 Bug ID: 107857 Summary: recursive_mutex misses destructor if non-function call initialization is used Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: pg.ensiie at gmail dot com Target Milestone: --- Hello, Using GCC 11.2.0 with mingw-w64 9.0.0. I notice that there is a memory leak when using a std::recursive_mutex, as described in this issue : https://sourceforge.net/p/mingw-w64/bugs/851/. I reproduce this bug. After some research, I discover that same problem has occured for std::mute= x, that was solved by this fix : https://sourceforge.net/p/mingw-w64/bugs/851/ The solution is to use function initialized and destructor for recursive_mu= tex as it is done for mutex when using pthread on windows. Defining _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC in os_defines.h fixes the bug. Even if I do not use it, I wonder if _GTHREAD_USE_COND_INIT_FUNC should als= o be set for condition variables.=