This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: fix latent bug in syms_from_objfile_1


>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:

Jan> On Wed, 20 Mar 2013 20:50:10 +0100, Tom Tromey wrote:
>> --- a/gdb/symfile.c
>> +++ b/gdb/symfile.c
Jan> [...]
>> @@ -205,11 +207,14 @@ alloc_section_addr_info (size_t num_sections)
>> struct section_addr_info *sap;
>> size_t size;
>> 
>> +  /* Make sure the size calculation turns out ok.  */
>> +  if (num_sections == 0)
>> +    ++num_sections;

Jan> I always thought such sizeof calculation works even with # of
Jan> elements == 0.  Why not?

It seemed weird to me since it would allocate an object smaller than a
struct section_addr_info.

I don't mind dropping that line though.

Jan> I am OK with the patch, thanks for the cleanup waiting for so many years.

Thanks.  I'm going to put it in today, since it is actively messing up
my regression tests.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]