From: Guinevere Larsen <guinevere@redhat.com>
To: gdb-patches@sourceware.org
Cc: Guinevere Larsen <guinevere@redhat.com>
Subject: [PATCH] gdbsupport: Remove some use after move instances
Date: Tue, 23 Jun 2026 17:21:54 -0300 [thread overview]
Message-ID: <20260623202153.2743258-2-guinevere@redhat.com> (raw)
A static analysis tool was ran on GDB and pointed out some instances of
"use after move" in GDB. The instances that could be easily removed
are related to move constructors for exceptions, that were using the
parameter's reason in an assert, when they could instead just use their
own internal "reason" member.
This patch fixes that small oversight.
---
There was another issue raised, but it was in the unordered_dense
library, which I don't know if I can just change or if I should submit a
PR to the upstream library.
---
gdbsupport/common-exceptions.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gdbsupport/common-exceptions.h b/gdbsupport/common-exceptions.h
index 1f3bc84216e..37c6e94d5a3 100644
--- a/gdbsupport/common-exceptions.h
+++ b/gdbsupport/common-exceptions.h
@@ -297,7 +297,7 @@ struct gdb_exception_error : public gdb_exception
explicit gdb_exception_error (gdb_exception &&ex) noexcept
: gdb_exception (std::move (ex))
{
- gdb_assert (ex.reason == RETURN_ERROR);
+ gdb_assert (reason == RETURN_ERROR);
}
};
@@ -312,7 +312,7 @@ struct gdb_exception_quit : public gdb_exception
explicit gdb_exception_quit (gdb_exception &&ex) noexcept
: gdb_exception (std::move (ex))
{
- gdb_assert (ex.reason == RETURN_QUIT);
+ gdb_assert (reason == RETURN_QUIT);
}
};
@@ -327,7 +327,7 @@ struct gdb_exception_forced_quit : public gdb_exception
explicit gdb_exception_forced_quit (gdb_exception &&ex) noexcept
: gdb_exception (std::move (ex))
{
- gdb_assert (ex.reason == RETURN_FORCED_QUIT);
+ gdb_assert (reason == RETURN_FORCED_QUIT);
}
};
base-commit: 717ef05c9c6d5f7a07540df2e79853d04b56f750
--
2.54.0
next reply other threads:[~2026-06-23 20:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 20:21 Guinevere Larsen [this message]
2026-06-23 20:30 ` Simon Marchi
2026-06-24 11:57 ` Guinevere Larsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260623202153.2743258-2-guinevere@redhat.com \
--to=guinevere@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox