Selon Thomas Sailer <[EMAIL PROTECTED]>:

> On Wed, 2005-12-07 at 15:12 +0100, Tristan Gingold wrote:
>
> > Humm, this is a bug related to x86_64.  I will fix it.
>
> I've been looking a bit more into the real'image problem. It seems to be
> a calling conventions problem for snprintf.
>
> When I call snprintf from C with one double vararg argument, the
> compiler puts the arguments into the following registers:
>
> %rdi  Buffer
> %esi  Buffer Size
> %edx  Format String
> %xmm0 Double Argument
> %eax  set to 1 (means one arg in xmm)
>
> However, gnat compiles the call to snprintf as follows:
>
> %rdi  Buffer
> %esi  Buffer Size
> %edx  Format String
> %r12  Double Argument
>
> %eax is not set
>
> x86_64 apparently as rather baroque vararg conventions. I have found no
> portable way to synthesize C vararg calls in Ada, so it seems like a C
> wrapper is needed.
Yes, this was my first fix.

> BTW, using snprintf %g to print reals has another drawback: snprintf can
> create strings that aren't considered valid floating point constants in
> VHDL, like "100".
Yes, I fell into that trap.
I am writing a small Ada code to do the conversion.
Just stay tuned!

Thanks,
Tristan.

Reply via email to