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: BUG: printf formatting libc.so.6


void main(void) { printf("%1$d %1$c %2$d %2$c\n", 32, 49); }

This fails on ancient glibc's, with ancient gcc's, too. The failure mode is more apparent on big-endian systems.

See union printf_arg and how it's used in vfprintf.c .

The fix is probably to document not to use a positional
parameter more than once.


Segher




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