public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Compilation problem in copying a va_list variable on a 64-bit  machine
@ 2010-03-02 18:03 Kristis Makris
  2010-03-02 19:12 ` Kevin P. Fleming
  0 siblings, 1 reply; 2+ messages in thread
From: Kristis Makris @ 2010-03-02 18:03 UTC (permalink / raw)
  To: gcc-help

[-- Attachment #1: Type: text/plain, Size: 1143 bytes --]

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

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Compilation problem in copying a va_list variable on a 64-bit   machine
  2010-03-02 18:03 Compilation problem in copying a va_list variable on a 64-bit machine Kristis Makris
@ 2010-03-02 19:12 ` Kevin P. Fleming
  0 siblings, 0 replies; 2+ messages in thread
From: Kevin P. Fleming @ 2010-03-02 19:12 UTC (permalink / raw)
  To: Kristis Makris; +Cc: gcc-help

Kristis Makris wrote:

> 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 ?

va_copy()

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kfleming@digium.com
Check us out at www.digium.com & www.asterisk.org

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-02 19:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-02 18:03 Compilation problem in copying a va_list variable on a 64-bit machine Kristis Makris
2010-03-02 19:12 ` Kevin P. Fleming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).