This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/3] PR symtab/20652 - fix psymbol_compare
On 10/03/2016 10:54 PM, Tom Tromey wrote:
> @@ -1577,7 +1577,7 @@ psymbol_compare (const void *addr1, const void *addr2, int length)
> struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
> struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
>
> - return (memcmp (&sym1->ginfo.value, &sym1->ginfo.value,
> + return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value,
> sizeof (sym1->ginfo.value)) == 0
I wonder whether using memcpy is really the correct thing
here, considering ginfo.value is a union. I.e., thinking about
padding bits not part of the active member. Maybe we're zero
initializing the whole value and it works in practice because
of that.
> && sym1->ginfo.language == sym2->ginfo.language
> && PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2)
Thanks,
Pedro Alves