This is the mail archive of the mailing list for the binutils 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: [PATCH] gold: fix some signed-unsigned comparison warnings

On Thu, Nov 1, 2012 at 3:12 PM, Cary Coutant <> wrote:
>> --- a/gold/
>> +++ b/gold/
>> @@ -57,7 +57,7 @@ Sized_elf_reloc_mapper<size, big_endian>::symbol_section(
>>      unsigned int symndx, Address* value, bool* is_ordinary)
>>  {
>>    const int symsize = elfcpp::Elf_sizes<size>::sym_size;
>> -  gold_assert((symndx + 1) * symsize <= this->symtab_size_);
>> +  gold_assert(static_cast<off_t>((symndx + 1) * symsize) <=
>> this->symtab_size_);
>>    elfcpp::Sym<size, big_endian> elfsym(this->symtab_ + symndx * symsize);
>>    *value = elfsym.get_st_value();
>>    return this->object_->adjust_sym_shndx(symndx, elfsym.get_st_shndx(),
> You didn't like my suggestion to declare symsize as an off_t to begin with?

Actually I overlooked entirely that you'd said that.
But on reflection, I don't think it's really the right thing to do.
It's not the natural type for sym_size, and changing its type that
way is a much less obvious way to effect the change of the type of
the expression in the lhs of that comparison, especially given that
matching the rhs of the comparison is the only reason to use that type.

I committed these parts of the change, leaving the bits for
further discussion.


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