diff options
author | Tom Tromey <tromey@adacore.com> | 2020-06-16 11:28:23 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-09-09 12:48:27 -0600 |
commit | 1b788fb6e9860c2e3aa0f9bbcedcd5feded1aa6e (patch) | |
tree | 02f974ac5df380b36cc066ec5754f7dbee2d643d /ltversion.m4 | |
parent | 10556cdc8e4340b0dcc2594aec044ba7b6da4aff (diff) | |
download | gdb-1b788fb6e9860c2e3aa0f9bbcedcd5feded1aa6e.zip gdb-1b788fb6e9860c2e3aa0f9bbcedcd5feded1aa6e.tar.gz gdb-1b788fb6e9860c2e3aa0f9bbcedcd5feded1aa6e.tar.bz2 |
Fix latent bug in ada-lang.c:remove_extra_symbols
I believe ada-lang.c:remove_extra_symbols has a latent bug. This
function loops over a vector of symbols, removing duplicates according
to some criteria.
At the end of the loop it does:
if (remove_p)
syms->erase (syms->begin () + i);
i += 1;
However, this seems wrong to me -- when removing the i'th element,
this code still increments "i", thus skipping an element.
At first I thought this was a regression from the patches to remove
cleanups from ada-lang.c (this was when std::vector was introduced);
but I found that instead the bug seems to be older:
if (remove_p)
{
for (j = i + 1; j < nsyms; j += 1)
syms[j - 1] = syms[j];
nsyms -= 1;
}
i += 1;
No test, as I don't know how to write one.
As this is Ada-specific, and was already reviewed internally by Joel,
I am checking it in.
gdb/ChangeLog
2020-09-09 Tom Tromey <tromey@adacore.com>
* ada-lang.c (remove_extra_symbols): Do not increment when
removing an element
Diffstat (limited to 'ltversion.m4')
0 files changed, 0 insertions, 0 deletions