This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Function with variable number of arguments.




 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




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]