public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jean-marc dot valin at usherbrooke dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/29925]  New: Wrong code with -ftree-vectorize
Date: Tue, 21 Nov 2006 12:22:00 -0000	[thread overview]
Message-ID: <bug-29925-8625@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2006-11-21 12:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-21 12:22 jean-marc dot valin at usherbrooke dot ca [this message]
2006-11-21 12:24 ` [Bug c/29925] " jean-marc dot valin at usherbrooke dot ca
2006-11-21 12:30 ` jean-marc dot valin at usherbrooke dot ca
2006-11-21 12:32 ` jean-marc dot valin at usherbrooke dot ca
2006-11-21 12:35 ` rguenth at gcc dot gnu dot org
2006-11-21 14:29 ` [Bug tree-optimization/29925] " jean-marc dot valin at usherbrooke dot ca
2006-12-14 12:42 ` irar at il dot ibm dot com
2006-12-14 13:28 ` jean-marc dot valin at usherbrooke dot ca
2006-12-30  6:42 ` jean-marc dot valin at usherbrooke dot ca
2007-03-05  8:01 ` patchapp at dberlin dot org
2007-03-11 13:47 ` irar at gcc dot gnu dot org
2007-03-12  6:57 ` irar at gcc dot gnu dot org
2007-07-01  8:35 ` dorit at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29925-8625@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).