public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] Fix off-by-one error
@ 2023-06-23  2:36 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2023-06-23  2:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Simon pointed out that commit a2bbca9fa5e ("Use std::vector<bool> for
agent_expr::reg_mask") caused a regression in libstdc++ debug mode.
This was due to an off-by-one error in a vector resize.  This patch
fixes the problem.
---
 gdb/ax-general.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/ax-general.c b/gdb/ax-general.c
index 3c724a0e38b..26a27a0bcad 100644
--- a/gdb/ax-general.c
+++ b/gdb/ax-general.c
@@ -414,7 +414,7 @@ ax_reg_mask (struct agent_expr *ax, int reg)
 
       /* Grow the bit mask if necessary.  */
       if (reg >= ax->reg_mask.size ())
-	ax->reg_mask.resize (reg);
+	ax->reg_mask.resize (reg + 1);
 
       ax->reg_mask[reg] = true;
     }
-- 
2.39.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-23  2:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-23  2:36 [pushed] Fix off-by-one error Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).