Problems with double arguments to varargs on MIPS
Simon Kagstrom
simon.kagstrom@bth.se
Tue Jan 9 10:01:00 GMT 2007
At some time ago,
Simon Kagstrom wrote:
>
> [1 <text/plain; US-ASCII (7bit)>]
> Hello,
>
> I have a problem with code generated by GCC for varargs on MIPS.
[...]
> double scratch;
>
> void maboo(int fmt, ...) {
> va_list ap;
>
> va_start(ap, fmt);
> scratch = (double)va_arg(ap, double);
> va_end(ap);
> }
>
> int main(int argc, char* argv[]) {
> maboo(0, 1.9F);
>
> if ( !(scratch >= 1.89 && scratch <= 1.91) )
> printf("ERRORERROR!\n");
> }
[...]
I found the error - and I *think* it was on my part, but I'm not
sure. When I align the stack pointer at startup to 8 this seems to
work, so maybe this was the error all along? I've written the runtime
environment, so maybe this was just wrong.
Is the stack-alignment requirements spelled out somewhere? I quickly
glanced in the gcc and gccint info-pages, but didn't find it there.
// Simon
More information about the Gcc-help
mailing list