This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_va_list bug or feature
"Joseph S. Myers" <jsm28 at cam dot ac dot uk> said:
> 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.
Black talk and geek speech. The code is always executed when the format
in question was used (%D in a custom va-function).
So the unpromote type is wrong, so what! The djgpp va_arg() macro
picks up the wrong type, but the stack isn't messed up. I'd rather prefer
wrong output than a generated trap. Which neither MingW nor djgpp
have handlers for. Seems gcc is biased towards Linux in this case.
Gisle V.
# rm /bin/laden
/bin/laden: Not found