__builtin_va_list bug ir feature
Joseph S. Myers
jsm28@cam.ac.uk
Fri Apr 25 18:02:00 GMT 2003
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@cam.ac.uk
More information about the Gcc
mailing list