This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: BUG: printf formatting libc.so.6
- From: Segher Boessenkool <segher at koffie dot nl>
- To: Bruce Korb <bkorb at veritas dot com>
- Cc: Petr Vandrovec <VANDROVE at vc dot cvut dot cz>, bug-glibc at gnu dot org,schwab at suse dot de, GCC Development <gcc at gcc dot gnu dot org>
- Date: Tue, 27 May 2003 14:34:23 +0100
- Subject: Re: BUG: printf formatting libc.so.6
- References: <2A0007B587D@vcnet.vc.cvut.cz> <3ED266D7.DA658597@veritas.com>
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