Search for int size-dependent code

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The objcopy thread was about generating a one-off to discover
how badly some non-working third-party code is non-working.
If I get the answer I expect,
I'll be looking for int size-dependent results.
The third party seems to have been fairly
consistent about using size-specific types,
but that will not catch everything:

uint16_t x=1024;
uint32_t x2=x*x;  // not rare on avrfreaks

The value of x2 depends on the size of int.

 

Is this the sort of thing that most static analyzers generally find?
If not, any suggestions?

 

Such an analyzer would be useful for
people trying to test AVR code on PC's.
Methinks that that is exactly what happened in this case.

 

Absent advice, I'll start wading through some free documentation.

 

For the truly ambitious (masochist?):
Make a pc16-gcc and accompanying tools.
In other words: it runs on a PC, but has a 16-bit int.

"For every Christmas tree lit before Thanksgiving,
an elf drowns a baby reindeer"