From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24764 invoked by alias); 21 Nov 2006 12:22:24 -0000 Received: (qmail 24734 invoked by uid 48); 21 Nov 2006 12:22:14 -0000 Date: Tue, 21 Nov 2006 12:22:00 -0000 Subject: [Bug c/29925] New: Wrong code with -ftree-vectorize X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jean-marc dot valin at usherbrooke dot ca" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-11/txt/msg01872.txt.bz2 List-Id: 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