This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/10719] invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Oct 2003 19:44:41 -0000
- Subject: [Bug c/10719] invalid code generated (x86, "int $5") with __builtin_va_arg(va, char);
- References: <20030509203601.10719.sb@biallas.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10719
------- Additional Comments From pinskia at gcc dot gnu dot org 2003-10-15 19:44 -------
Here is the quote from the C standard, from a search of "va_arg undefined behavior promotion":
<http://lists.debian.org/debian-powerpc/2000/debian-powerpc-200010/msg00384.html>:
Here is the relevant part of ISO C Working Draft, 1997-11-21, WG14/N794 J11/97-158:
7.12.1.2 The va_arg macro
Synopsis
1 #include <stdarg.h>
type va_arg(va_list ap, type);
Description
2 The va_arg macro expands to an expression that has the type and value of the next
argument in the call. The parameter ap shall be the same as the va_list ap
initialized by va_start. Each invocation of va_arg modifies ap so that the values
of successive arguments are returned in turn. The parameter type is a type name
specified such that the type of a pointer to an object that has the specified type can be
obtained simply by postfixing a * to type. If there is no actual next argument, or if
type is not compatible with the type of the actual next argument (as promoted
according to the default argument promotions), the behavior is undefined.