public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/19113] New: Assigning to va_list var is valid for va_arg calls but not other cases
@ 2004-12-21 17:54 hjl at lucon dot org
2004-12-21 18:43 ` [Bug c/19113] " pinskia at gcc dot gnu dot org
2004-12-21 19:28 ` joseph at codesourcery dot com
0 siblings, 2 replies; 3+ messages in thread
From: hjl at lucon dot org @ 2004-12-21 17:54 UTC (permalink / raw)
To: gcc-bugs
With gcc 3.4.3, I got
[hjl@gnu-20 tmp]$ cat a.c
#include <stdarg.h>
void
foo(int l, ...)
{
va_list p,q,r;
va_start(p,l);
#if WORK
q = va_arg(p,va_list);
#else
/* The following code fails */
q = r;
#endif
}
[hjl@gnu-20 tmp]$ gcc -S a.c
a.c: In function `foo':
a.c:11: incompatible types in assignment
[hjl@gnu-20 tmp]$ gcc -S a.c -DWORK
It used to work in gcc 2.96:
[hjl@gnu-6 tmp]$ gcc -S a.c
[hjl@gnu-6 tmp]$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-128.7.2)
Is that a bug or a feature?
--
Summary: Assigning to va_list var is valid for va_arg calls but
not other cases
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: hjl at lucon dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19113
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/19113] Assigning to va_list var is valid for va_arg calls but not other cases
2004-12-21 17:54 [Bug c/19113] New: Assigning to va_list var is valid for va_arg calls but not other cases hjl at lucon dot org
@ 2004-12-21 18:43 ` pinskia at gcc dot gnu dot org
2004-12-21 19:28 ` joseph at codesourcery dot com
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-21 18:43 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-12-21 18:43 -------
Use va_copy as this is invalid c.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19113
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/19113] Assigning to va_list var is valid for va_arg calls but not other cases
2004-12-21 17:54 [Bug c/19113] New: Assigning to va_list var is valid for va_arg calls but not other cases hjl at lucon dot org
2004-12-21 18:43 ` [Bug c/19113] " pinskia at gcc dot gnu dot org
@ 2004-12-21 19:28 ` joseph at codesourcery dot com
1 sibling, 0 replies; 3+ messages in thread
From: joseph at codesourcery dot com @ 2004-12-21 19:28 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-12-21 19:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-21 17:54 [Bug c/19113] New: Assigning to va_list var is valid for va_arg calls but not other cases hjl at lucon dot org
2004-12-21 18:43 ` [Bug c/19113] " pinskia at gcc dot gnu dot org
2004-12-21 19:28 ` joseph at codesourcery dot com
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).