avr-gcc-list
[Top][All Lists]
Advanced

[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


From: Philipp Burch
Subject: Re: [avr-gcc-list] BYTE4 and BYTE3 of an int32_t get cleared after va_arg(vl, int32_t)?!
Date: Fri, 28 Dec 2007 22:23:06 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Hi again,

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,
Philipp
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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]