Ive had problems with avr-gcc when using a mix of variable sizes.
I'd recommend that you try to break it down into similar variables sizes eg:
// here are your 3 variables
// Subtract the 32 bit stuff to start with
v1 = v1 - v2;
// Multiply the 32 bit answer by a 16 bit number and store 32 bit answer
v2 = v1 * v3;
// Divide by 1000(Unsigned) and store as 16 bit result
v3 = v2 / 1000U;
That, or something similiar
, should work.
avr-gcc seems VERY flakey when trying to work with a single expression of multiple data sizes. And it will mess it up regardless of any optimisation settings.