From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7A3623858D1E; Wed, 17 May 2023 15:50:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A3623858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684338633; bh=NJjpF+YU7E8tY4trW5ygEaYbpcpZ7OUCb5omwlX8CB4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=tJHhPIvGuX+W2XpXAkaNW92v7f/wZH7QUFmQBXySrL8MzT5QbzJkAMVNXc6lEviJW +ki3pc7VQzhIwiXejh6VlOvLDnbaWKDfnQOzviDnKuhWanAJ02ZUZT0ZxPMAmjQQqn b9kO6GgwLVH9JKMp++TI2cOgpr5MJsDy5cBiAXx0= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/109889] [13/14 Regression] Segfault in __run_exit_handlers since r13-5309-gc3c6c307792026 Date: Wed, 17 May 2023 15:50:33 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org 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: Message-ID: In-Reply-To: References: 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=3D109889 --- Comment #7 from Jonathan Wakely --- When the function returns the iterator's destructor should detach itself fr= om the sequence's list of iterators, so that it doesn't outlive the stack frame containing the iterator. The commit that caused the regression included this change: _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), _M_message(__msg_bad_inc) ._M_iterator(*this, "this")); - _Safe_iterator __ret =3D *this; + _Safe_iterator __ret(*this, _Unchecked()); ++*this; return __ret; } Maybe this affects how/when the __ret object gets destroyed, so it fails to detach itself.=