From 8a269c262e3d0611c01edd915f230bbd2ad78015 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 22 Jun 2023 20:34:56 -0600 Subject: [PATCH] Fix off-by-one error Simon pointed out that commit a2bbca9fa5e ("Use std::vector 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.30.2