[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_arg(vl
[avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_arg(vl, int32_t)?!
Fri, 28 Dec 2007 11:03:22 +0100
Thunderbird 18.104.22.168 (Windows/20071031)
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:
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,
- [avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_arg(vl, int32_t)?!,
Philipp Burch <=