Compilation problem in copying a va_list variable on a 64-bit machine

Kristis Makris mkgnu@mkgnu.net
Tue Mar 2 18:03:00 GMT 2010


Hello,

I am writing a program that needs to copy a variable of type
__builtin_va_list. Copying this variable works correctly with gcc-4.1 on
a 32-bit machine, but it reports a compilation error on a 64-bit
machine. The program is:

#include <stdarg.h>

int main()
{
  va_list l1;
  va_list l2;

  l1 = l2;

  return 0;
}

There is no error on a 32-bit machine with gcc-4.1:

$ gcc-4.1 --version
gcc-4.1 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
$ gcc-4.1 t.c



The error on a 64-bit machine with gcc-4.1 is:

$ gcc-4.1 --version
gcc-4.1 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
$ gcc-4.1 t.c
t.c: In function 'main':
t.c:8: error: incompatible types in assignment



The error on a 64-bit machine with gcc-4.4 is:
$ gcc-4.4 --version
gcc-4.4 (Ubuntu 4.4.1-4ubuntu9) 4.4.1
$ gcc-4.4 t.c
t.c: In function 'main':
t.c:8: error: incompatible types when assigning to type 'va_list' from type 'struct __va_list_tag *'



Is this a bug in gcc on 64-bit machines ? What is the appropriate way of
copying a variable of type va_list that needs to be preserved ?

Thanks,
Kristis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20100302/0f763cea/attachment.sig>


More information about the Gcc-help mailing list