Re: [PATCH 0/4] bitpos expansion summary reloaded

Jan Kratochvil
2012-09-29T17:39:51Z

Hi Siddhesh,

I have reported without effect:
But for example ada-valprint.c:700 is not reported in this file at all, why?

ada-valprint.c:700 is the last line of this extracted code:
LONGEST offset;
int offset_aligned;
const gdb_byte *valaddr;
const gdb_byte *ada_aligned_value_addr (struct type *type, const gdb_byte *valaddr);
offset_aligned = offset + ada_aligned_value_addr (type, valaddr) - valaddr;

Reduced testcase:
int main (void) {
const char *a = "", *b = "";
int reported, missed;
long longvar = 0;
reported = longvar;
missed = longvar + a - b;
return reported + missed; }

splint -hints -linelen 999:
../../../t/t.c: (in function main)
../../../t/t.c:5:3: Assignment of long int to int: reported = longvar

splint -hints -linelen 999 -checks:
../../../t/t.c: (in function main)
../../../t/t.c:5:3: Assignment of long int to int: reported = longvar
../../../t/t.c:6:22: Pointer arithmetic involving possibly null pointer a: longvar + a

splint -hints -linelen 999 -strict:
../../../t/t.c: (in function main)
../../../t/t.c:5:3: Assignment of long int to int: reported = longvar
../../../t/t.c:6:12: Pointer arithmetic (long int, char *): longvar + a
../../../t/t.c:6:22: Pointer arithmetic involving possibly null pointer a: longvar + a
../../../t/t.c:6:12: Operands of - are non-numeric (char *): longvar + a - b

These warnings are in fact OK but the problematic assignment
of ptrdiff_t to int variable 'missed' is not reported at all.

We need to either fix splint or (more likely) use a different tool, there are
too many cases missed this way.

Regards,
Jan