This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/19113] Assigning to va_list var is valid for va_arg calls but not other cases
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2004 19:28:00 -0000
- Subject: [Bug c/19113] Assigning to va_list var is valid for va_arg calls but not other cases
- References: <20041221175407.19113.hjl@lucon.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2004-12-21 19:27 -------
Subject: Re: Assigning to va_list var is valid for va_arg calls
but not other cases
On Tue, 21 Dec 2004, pinskia at gcc dot gnu dot org wrote:
> Use va_copy as this is invalid c.
The compile-time validity depends on whether va_list is an array type (in
which case it should be rejected at compile-time) or some other object
type (in which case it shouldn't). Copying other than with va_copy is
merely undefined behavior at runtime.
However, I can't reproduce the original bug report on x86 which would
appear to be the target to which it was referring (from the compiler used
for comparison). x86-64 does use an array type so the reported behavior
would be correct on that target.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19113