[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_ar
Re: [avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_arg(vl, int32_t)?!
Fri, 28 Dec 2007 22:23:06 +0100
Thunderbird 184.108.40.206 (Windows/20071031)
I think the problem has just solved itself. I've redeclared val in
another part of the switch statement as a uint16_t... I really should
avoid such confusing code :(
Sorry for this unnecessary post,
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
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
I hope, someone can help me.
Thanks in Advance,
AVR-GCC-list mailing list