Bug in va_list/va_arg on PowerPC

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Tue Jul 18 06:21:00 GMT 2000


At 14:36 18.07.00, Stephane Bortzmeyer wrote:

>bortzmeyer@yoko:~/tmp$   gcc -c test-va.c
>test-va.c: In function `main':
>test-va.c:7: incompatible types in assignment
>
>bortzmeyer@yoko:~/tmp$   cat test-va.c
>#include <stdarg.h>
>
>int main () {
>
>   va_list values;
>   va_list args;
>   values = va_arg(args,va_list);
>
>}
>
>[Output of gcc -E attached.]
>
>The same code compiles fine on an i386, same version of gcc, same OS, and on
>an Alpha, same version of gcc, Tru64 OS.
>
>
>[The actual code - the Java Virtual Machine kaffe - is much longer.]

This is no bug, this is non-portable code. Remember, va_list is an array 
type on Linux/PPC. The obvious, but non-working solution would be:

         __va_copy(values,va_arg(args,va_list));

Current gcc mainline (which has much better vararg handling and error 
reporting) reports:

[fsirl@entropy:~]$ ~/obj/gccm/gcc/xgcc -B ~/obj/gccm/gcc/ testva.c
testva.c: In function `main':
testva.c:8: invalid use of non-lvalue array

So probably the kaffe code has to be rearranged a bit to be portable, maybe 
make use of a va_list *?

Franz.



More information about the Gcc-bugs mailing list