Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] gdbsupport: Remove some use after move instances
@ 2026-06-23 20:21 Guinevere Larsen
  2026-06-23 20:30 ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Guinevere Larsen @ 2026-06-23 20:21 UTC (permalink / raw)
  To: gdb-patches; +Cc: Guinevere Larsen

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-24 11:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-23 20:21 [PATCH] gdbsupport: Remove some use after move instances Guinevere Larsen
2026-06-23 20:30 ` Simon Marchi
2026-06-24 11:57   ` Guinevere Larsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox