Hello all,
I've experienced some trouble compiling a program with avr-gcc. I've
made a replacement for the standard printf()-function to suit my
needs. So far, no problems. But inside this function there's quite a
big switch statement selecting the format specifier. Outside this
statement, there is an int32_t defined to hold the value of any given
numeric arguments. Depending on the format string, it is either pop'd
using
val = va_arg(vl, int16_t) or
val = va_arg(vl, int32_t).
I've used the debugger to check if the right one is called, that's ok.
But this conditional statement is used twice inside the switch (once
for integral values and once for fixed-point-values). The first time
all is translated fine, all four bytes are fetched correctly. But the
second time, only the two lower bytes are fetched and the upper bytes
are just nulled, whether va_arg() reads an int16_t or an int32_t.
The whole code and some disassembler listings can be found here:
http://www.mikrocontroller.net/topic/87044#736984
I don't know if this is a bug in the compiler or just a mistake in my
code.
I hope, someone can help me.
Thanks in Advance,
Philipp
_______________________________________________
AVR-GCC-list mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list