avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: [avr-libc-dev] Problem with unsigned long long printf()


From: Theodore A. Roth
Subject: Re: Fwd: [avr-libc-dev] Problem with unsigned long long printf()
Date: Sat, 18 Sep 2004 15:25:19 -0700 (PDT)

On Sat, 18 Sep 2004, Joerg Wunsch wrote:

> As Theodore A. Roth wrote:
>
> > > did you read this on the list? Is it a bug or not?
>
> (Which list btw.?)
>
> > First, avr-libc currently does not handle the '%llu', '%lld', etc.
> > specifiers. This was probably by design so as not to bloat the vfprintf
> > function any more than is already is.
>
> You're right on that assumption, Ted.  I thought for a moment about
> it, but gave up on it for the bloat that would have been caused by
> implementing 64-bit handling.
>
> Consequently, I never noticed the problem you've detected now.
>
> If at all, I'd at best like to implement it as an optional library
> (i.e. a fourth option to build/link vfprintf()).  However, I'm not
> really happy with the current way optional libraries have to be
> requested.  If anyone's got a cool idea for that, I'll be glad to hear
> about it.

I'm ok with adding another lib version ("extended" maybe??). Would you
mind handling this since it is really your domain? I'm in limbo at the
moment and don't have computer access at home and don't have much time
at work for the volunteer stuff.

>
> > To me, this looks suspiciously like gcc is not handling the
> >
> >   a.ull = va_arg (ap, unsigned long long);
> >
> > call correctly when the type is 64 bits. when passing a 64 bit variable
> > by value, gcc pushes the 8 bytes onto the stack instead of passing via 8
> > registers. If my analysis is correct, then there's a bug in gcc.
>
> Hmm, there are at most 8 registers available for argument passing.
> Thus, a 64-bit type could only be passed in registers if it is the
> sole (or very first) argument in a function call.  Anything else has
> go onto the stack.
>
> Also, variadic arguments can IMHO never be passed in registers, since
> the callee would never know which register to start.  AFAICT, they
> always go to the stack.
>
> Probably noone ever tested varargs handling for 64-bit types though.
> Since <stdarg.h> and all related stuff is in GCC's domain (as opposed
> to avr-libc's), well, yes, somehow there must be a bug in GCC here,
> but I'd rather suspect that __builtin_va* stuff than anything else.

Ok, we should let Marek and Denis know about this then.

---
Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden




reply via email to

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