Package: gcc-4.6 Version: 4.6.1-4 Severity: important Tags: upstream The attached code is being miscompiled with gcc-4.6 (works perfectly with 4.4 or 4.5). The error can be seen if valgrind is run on the resulting executable as:
==21804== Invalid read of size 4 ==21804== at 0x400437: main (c.c:12) ==21804== Address 0x51b1048 is 8 bytes inside a block of size 11 alloc'd ==21804== at 0x4C2779D: malloc (in /usr/lib/valgrind/vgpreload_memcheck- amd64-linux.so) ==21804== by 0x40040D: main (c.c:9) -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 3.0.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-4.6 depends on: ii binutils 2.21.52.20110606-2 The GNU assembler, linker and bina ii cpp-4.6 4.6.1-4 GNU C preprocessor ii gcc-4.6-base 4.6.1-4 GCC, the GNU Compiler Collection ( ii libc6 2.13-16 Embedded GNU C Library: Shared lib ii libcloog-ppl0 0.15.9-3 the Chunky Loop Generator (runtime ii libgcc1 1:4.6.1-4 GCC support library ii libgmp10 2:5.0.1+dfsg-7 Multiprecision arithmetic library ii libgmpxx4ldbl 2:5.0.1+dfsg-7 Multiprecision arithmetic library ii libgomp1 4.6.1-4 GCC OpenMP (GOMP) support library ii libmpc2 0.9-3 multiple precision complex floatin ii libmpfr4 3.0.1-5 multiple precision floating-point ii libppl-c4 0.11.2-4 Parma Polyhedra Library (C interfa ii libppl9 0.11.2-4 Parma Polyhedra Library (runtime l ii libquadmath0 4.6.1-4 GCC Quad-Precision Math Library ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime Versions of packages gcc-4.6 recommends: ii libc6-dev 2.13-16 Embedded GNU C Library: Developmen Versions of packages gcc-4.6 suggests: pn binutils-gold <none> (no description available) pn gcc-4.6-doc <none> (no description available) pn gcc-4.6-locales <none> (no description available) pn gcc-4.6-multilib <none> (no description available) pn libgcc1-dbg <none> (no description available) pn libgomp1-dbg <none> (no description available) pn libmudflap0-4.6-dev <none> (no description available) pn libmudflap0-dbg <none> (no description available) pn libquadmath0-dbg <none> (no description available)
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char** argv) { char *z; z = malloc(11); strcpy(z, "hello ppl"); /* 9 chars */ strcat(z, "."); /* + 1 */ return 0; }