This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: __builtin_va_list bug ir feature


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]