public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "graham.stott at btinternet dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/56932] [regression 4.8]: vrp and/or niter-related wrong-code bug
Date: Fri, 12 Apr 2013 12:22:00 -0000	[thread overview]
Message-ID: <bug-56932-4-WNcnHT9M56@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-56932-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56932

--- Comment #3 from graham.stott at btinternet dot com 2013-04-12 12:21:59 UTC ---
ktietz.

Access to a[250] is undefined  as pointed out by andrew.

Increase size of a to 251 to get the test passing.

Graham
>From gcc-bugs-return-419920-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Apr 12 12:40:08 2013
Return-Path: <gcc-bugs-return-419920-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 5154 invoked by alias); 12 Apr 2013 12:40:08 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 5081 invoked by uid 48); 12 Apr 2013 12:40:05 -0000
From: "wschmidt at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/56933] New: [4.9 Regression] Vectorizer missing read-write dependency for interleaved accesses
Date: Fri, 12 Apr 2013 12:40:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: tree-optimization
X-Bugzilla-Keywords: wrong-code
X-Bugzilla-Severity: normal
X-Bugzilla-Who: wschmidt at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Changed-Fields:
Message-ID: <bug-56933-4@http.gcc.gnu.org/bugzilla/>
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
Content-Type: text/plain; charset="UTF-8"
MIME-Version: 1.0
X-SW-Source: 2013-04/txt/msg01065.txt.bz2
Content-length: 2317


http://gcc.gnu.org/bugzilla/show_bug.cgi?idV933

             Bug #: 56933
           Summary: [4.9 Regression] Vectorizer missing read-write
                    dependency for interleaved accesses
    Classification: Unclassified
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: wschmidt@gcc.gnu.org
                CC: bergner@gcc.gnu.org, dje@gcc.gnu.org,
                    rguenth@gcc.gnu.org
              Host: powerpc*-*-*
            Target: powerpc*-*-*
             Build: powerpc*-*-*


Created attachment 29861
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id)861
Vectorization details dump for the test case

vect_analyze_group_access() in tree-vect-data-refs.c contains a test for
load-store dependencies:

              if (GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (next))
                  || GROUP_READ_WRITE_DEPENDENCE (vinfo_for_stmt (prev)))

Currently this always returns false because this field has not yet been set in
the vinfo.  This began with r196872, where the code to analyze accesses was
moved ahead of the code to analyze dependences.

I put together a test demonstrating that it's possible for us to generate
incorrect code as a result:

       subroutine test(a,b,c,d,e,f)
       integer k
       real*4, intent(out) :: a(1000)
       real*4, intent(out) :: b(1000)
       real*4, intent(in) :: c(1000)
       real*4, intent(inout) :: d(2000)
       real*4, intent(out) :: e(1000)
       real*4, intent(out) :: f(1000)

       do k = 1,1000
          a(k) = 3.0 * d(2*k)
          e(k) = 3.3 * d(2*k+1)
          d(2*k) = 2.0 * c(k)
          d(2*k+1) = 2.3 * c(k)
          b(k) = d(2*k) - 5.5;
          f(k) = d(2*k+1) + 5.5;
       enddo

       return
       end

I'm attaching a detailed dump of the vectorization pass that shows that the
values of d(2*k) and d(2*k+1) used to compute b(k) and f(k) are the ones loaded
prior to the stores to those locations.

To reproduce on powerpc64-unknown-linux-gnu:

$ gfortran -O3 -ffast-math -mcpu=power7 -fno-vect-cost-model interl-lsl-2.f


  parent reply	other threads:[~2013-04-12 12:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12 10:08 [Bug middle-end/56932] New: " ktietz at gcc dot gnu.org
2013-04-12 11:28 ` [Bug middle-end/56932] " pinskia at gcc dot gnu.org
2013-04-12 11:50 ` glisse at gcc dot gnu.org
2013-04-12 12:22 ` graham.stott at btinternet dot com [this message]
2013-04-12 18:31 ` ktietz at gcc dot gnu.org
2013-04-12 19:00 ` pinskia at gcc dot gnu.org
2013-04-12 20:02 ` glisse at gcc dot gnu.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-56932-4-WNcnHT9M56@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).