This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gold: fix some signed-unsigned comparison warnings
On Thu, Nov 1, 2012 at 3:12 PM, Cary Coutant <ccoutant@google.com> wrote:
>> --- a/gold/dwarf_reader.cc
>> +++ b/gold/dwarf_reader.cc
>> @@ -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 arm.cc/target.h bits for
further discussion.
Thanks,
Roland