From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C04E43858D28; Wed, 3 May 2023 10:49:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C04E43858D28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1683110979; bh=7ebFTRJ3v9/yPOUA3sORL2bQPYa28d7Hg/koivQ5Z7s=; h=From:To:Subject:Date:In-Reply-To:References:From; b=gfsKvmNEQroBehKKJ2hjTGpGuGsrSyUPCpwXsy5nVC1wEC+jpUjQZX8kAoeAKAikh HnFooF94uUuZfHzg5BTMb8srn1uB2W+/EqQotEsePI9wGY+k+9TvSPHC8bLJEUqYvJ ifTUVW5heRZj16o8tA4zBs3wOfhzIcZAkbO9oXAg= From: "vries at gcc dot gnu.org" To: gdb-prs@sourceware.org Subject: =?UTF-8?B?W0J1ZyBidWlsZC8zMDQxM10gW2dkYi9idWlsZF0gZXJyb3I6IHN0?= =?UTF-8?B?b3JpbmcgdGhlIGFkZHJlc3Mgb2YgbG9jYWwgdmFyaWFibGUg4oCYPGFub255?= =?UTF-8?B?bW91cz7igJkgaW4g4oCYZnJhbWVfaW5mb19wdHI6OmZyYW1lX2xpc3QuaW50?= =?UTF-8?B?cnVzaXZlX2xpc3Q8ZnJhbWVfaW5mb19wdHI+OjptX2JhY2vigJkgWy1XZXJy?= =?UTF-8?B?b3I9ZGFuZ2xpbmctcG9pbnRlcj1d?= Date: Wed, 03 May 2023 10:49:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: build X-Bugzilla-Version: HEAD X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot 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://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30413 --- Comment #5 from Tom de Vries --- I think the thing the warning complains about is that adding to the list is unconditional, and removing from the list is conditional (on is_linked), and the compiler can't figure out that for the temporary object is_linked () = =3D=3D true. [ You could reason that the warning is too aggressive, but that may be intentional, I'm not sure. ] The test on is_linked was introduced because of trying to accommodate the scenario mentioned in the comment: ... ~frame_info_ptr () { /* If this node has static storage, it may be deleted after=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20 frame_list. Attempting to erase ourselves would then trigger=20=20= =20=20=20=20=20=20=20=20=20=20 internal errors, so make sure we are still linked first. */ if (is_linked ()) frame_list.erase (frame_list.iterator_to (*this)); } ... So perhaps we can fix this by removing the is_linked test. The code was ad= ded because the static frame_list and the static frame_info_ptr where in differ= ent compilation units, but that's no longer the case. So I'm thinking of: ... diff --git a/gdb/frame.c b/gdb/frame.c index 36fb02f3c8e..c47244b8cb2 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -1733,6 +1733,11 @@ get_current_frame (void) static frame_id selected_frame_id =3D null_frame_id; static int selected_frame_level =3D -1; +/* See frame-info-ptr.h. This definition should come before any definitio= n of + a static frame_info_ptr. */ + +intrusive_list frame_info_ptr::frame_list; + /* The cached frame_info object pointing to the selected frame. Looked up on demand by get_selected_frame. */ static frame_info_ptr selected_frame; @@ -3275,10 +3280,6 @@ maintenance_print_frame_id (const char *args, int from_tty) /* See frame-info-ptr.h. */ -intrusive_list frame_info_ptr::frame_list; - -/* See frame-info-ptr.h. */ - frame_info_ptr::frame_info_ptr (struct frame_info *ptr) : m_ptr (ptr) { diff --git a/gdb/frame.h b/gdb/frame.h index 6ed8db0af56..fff5c248070 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -257,8 +257,8 @@ class frame_info_ptr : public intrusive_list_node /* If this node has static storage, it may be deleted after frame_list. Attempting to erase ourselves would then trigger internal errors, so make sure we are still linked first. */ - if (is_linked ()) - frame_list.erase (frame_list.iterator_to (*this)); + gdb_assert (is_linked ()); + frame_list.erase (frame_list.iterator_to (*this)); } frame_info_ptr &operator=3D (const frame_info_ptr &other) ... --=20 You are receiving this mail because: You are on the CC list for the bug.=