Bug#668581: gcc-4.6: scanf() wrong read on 08 09 integers
Package: gcc-4.6
Version: 4.6.3-3
Severity: normal
Hi,
I was debugging a more complex problem and noticed that not all
input values were read. Further inspection showed that input
integers "08" and "09" (read from a file) were not correctly
recognised by fscanf() as two integers (8 and 9) but as four
integers (0 8 0 9). I've attached a minimal test C program
and a test file. After compile execute:
$ ./tscanf0809 < tscanf0809.txt
Thanks
-- System Information:
Debian Release: wheezy/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=ro_RO.utf8, LC_CTYPE=ro_RO.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages gcc-4.6 depends on:
ii binutils 2.22-6
ii cpp-4.6 4.6.3-3
ii gcc-4.6-base 4.6.3-3
ii libc6 2.13-27
ii libgcc1 1:4.7.0-3
ii libgmp10 2:5.0.4+dfsg-1
ii libgomp1 4.7.0-3
ii libmpc2 0.9-4
ii libmpfr4 3.1.0-4
ii libquadmath0 4.7.0-3
ii zlib1g 1:1.2.6.dfsg-2
Versions of packages gcc-4.6 recommends:
ii libc6-dev 2.13-27
Versions of packages gcc-4.6 suggests:
pn binutils-gold <none>
pn gcc-4.6-doc <none>
pn gcc-4.6-locales 4.6.3-3
pn gcc-4.6-multilib <none>
pn libgcc1-dbg 1:4.7.0-3
pn libgomp1-dbg <none>
pn libmudflap0-4.6-dev <none>
pn libmudflap0-dbg <none>
pn libquadmath0-dbg <none>
-- no debconf information
#include <stdio.h>
int main(void)
{
int n;
while (1 == scanf("%i", &n))
printf("n = %i\n", n);
return 0;
}
01
02
03
04
05
06
07
08
09
10
01 02 03 04 05 06 07 08 09 10
Reply to: