This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Function with variable number of arguments.
- To: <bug-gcc-request at gnu dot org>
- Subject: Function with variable number of arguments.
- From: "Alexey S. Fadeyev" <alexey at mdis dot ru>
- Date: Thu, 30 Sep 1999 17:14:10 +0400
- Cc: <gnu at gnu dot org>, <bug-gcc at gnu dot org>, <help-gcc at gnu dot org>
I write following function
int test(char * format,...)
va_list marker
va_start(marker,format);
return va_arg(marker,int);
}
int i ;
rtems_task Init( rtems_task_argument ignored )
i = test("ABC",0xAA55);
exit(0);
}
I expect to see 0xAA55 in i but recieve 0.
After pre-processing I see
va_list marker;
( marker = (__gnuc_va_list) __builtin_next_arg ( format )) ;
return (( int *) (void *) ( marker = (char *) ((((int ) marker +
8 - 1) & -8) + (((sizeof ( int ) + 8 - 1) / 8) * 8) )))[-1] ;
I think problem is in __builtin_next_arg - I did't see it anywhere.
Did anyone faced with this problem?
Host: RedHat 5.2
Target: mips64orion
egsc-1.1b
newlib-1.8.0
binutils-2.9.1
Thanx in advance
Alexey