This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in va_list/va_arg on PowerPC
- To: Stephane Bortzmeyer <bortzmeyer at pasteur dot fr>
- Subject: Re: Bug in va_list/va_arg on PowerPC
- From: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Date: Tue, 18 Jul 2000 15:21:10 +0200
- Cc: gcc-bugs at gcc dot gnu dot org,bortzmeyer at pasteur dot fr,edeveaud at pasteur dot fr,"Edouard G. Parmelan" <egp at free dot fr>,babafou at pasteur dot fr
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.