This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/29925] New: Wrong code with -ftree-vectorize
- From: "jean-marc dot valin at usherbrooke dot ca" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Nov 2006 12:22:14 -0000
- Subject: [Bug c/29925] New: Wrong code with -ftree-vectorize
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I just hit what seems to be a wrong code generation bug in gcc. The bug happens
only when compiling the attached file with:
gcc -g -O1 -ffast-math -ftree-vectorize gcc_bug.c -o gcc_bug
Removing any one of -O1 -ffast-math -ftree-vectorize makes the problem go away.
When I run the complete code (which is in the Speex codec BTW), not only do I
get the wrong result, but there is a "read past array" that happens. With the
reduced example, only the read error is visible and valgrind reports:
==9508== Invalid read of size 8
==9508== at 0x4004E3: interp_pitch (gcc_bug.c:17)
==9508== by 0x4005D2: main (gcc_bug.c:29)
==9508== Address 0x4D64224 is 500 bytes inside a block of size 504 alloc'd
==9508== at 0x4A1FB37: calloc (vg_replace_malloc.c:279)
==9508== by 0x4005A8: main (gcc_bug.c:25)
This is on an Ubuntu 64-bit Edgy machine with gcc -v:
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --enable-checking=release
x86_64-linux-gnu
Thread model: posix
gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5)
--
Summary: Wrong code with -ftree-vectorize
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jean-marc dot valin at usherbrooke dot ca
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29925