This is the mail archive of the
mailing list for the GCC project.
Re: __builtin_va_list bug ir feature
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- To: Gisle Vanem <gvanem at eunet dot no>
- Cc: gcc at gcc dot gnu dot org
- Date: Fri, 25 Apr 2003 18:01:37 +0100 (BST)
- Subject: Re: __builtin_va_list bug ir feature
- References: <firstname.lastname@example.org>
On Fri, 25 Apr 2003, Gisle Vanem wrote:
> Is this a gcc bug or feature? I found absolutely nothing in the
> gcc online docs about this. If it's a feature, what's the rationale
> behind it? IMHO if gcc should treat this as a fatal error instead
> of emitting a bound trap (int $5). That is just too nasty. I spent
> a full day tracking this down.
The C standard permits this _in code that is never executed_ - it is
undefined behavior _at runtime_ if the wrong type is used in va_arg, and
an unpromoted type is necessarily wrong, but the function containing the
bad use of va_arg might never be executed, or that bad call might never be
executed, so it can't be a hard error, but instead is a mandatory warning,
with a trap generated in case the code is ever in fact executed.
Joseph S. Myers
jsm28 at cam dot ac dot uk