|
From: Nicholas N. <nj...@cs...> - 2005-03-13 15:06:21
|
Hi,
With GCC-4.0.0-pre, I get this warning:
vg_symtab2.c: In function 'canonicaliseLoctab':
vg_symtab2.c:691: warning: large integer implicitly truncated to unsigned type
The relevant code looks like this:
if (si->loctab[i].addr + si->loctab[i].size > si->loctab[i+1].addr) {
/* Do this in signed int32 because the actual .size fields
are unsigned 16s. */
Int new_size = si->loctab[i+1].addr - si->loctab[i].addr;
if (new_size < 0) {
si->loctab[i].size = 0;
} else
if (new_size >= 65536) {
si->loctab[i].size = 65535;
} else {
si->loctab[i].size = (UShort)new_size;
}
}
I think the problem is that the 'size' field of the RiLoc struct is only a
12-bit integer. So I think the relevant part of the code above should be
changed to this:
if (new_size > MAX_LOC_SIZE) {
si->loctab[i].size = MAX_LOC_SIZE;
} else {
si->loctab[i].size = (UShort)new_size;
}
Can someone confirm this is the right thing to do here? Thanks.
N
|
|
From: Nicholas N. <nj...@cs...> - 2005-03-16 02:36:55
|
On Sun, 13 Mar 2005, Nicholas Nethercote wrote:
> vg_symtab2.c: In function 'canonicaliseLoctab':
> vg_symtab2.c:691: warning: large integer implicitly truncated to unsigned
> type
> [...]
> I think the problem is that the 'size' field of the RiLoc struct is only a
> 12-bit integer. So I think the relevant part of the code above should be
> changed to this:
>
> if (new_size > MAX_LOC_SIZE) {
> si->loctab[i].size = MAX_LOC_SIZE;
> } else {
> si->loctab[i].size = (UShort)new_size;
> }
>
> Can someone confirm this is the right thing to do here? Thanks.
Since no-one complained, I'm going to commit this.
N
|