public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/56962] New: [4.8/4.9 Regression] SLSR caused miscompilation of fftw
Date: Mon, 15 Apr 2013 08:25:00 -0000	[thread overview]
Message-ID: <bug-56962-4@http.gcc.gnu.org/bugzilla/> (raw)


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

             Bug #: 56962
           Summary: [4.8/4.9 Regression] SLSR caused miscompilation of
                    fftw
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org


Reduced testcase:
extern void abort (void);
long double v[144];

__attribute__((noinline, noclone)) void
bar (long double *x)
{
  if (x != &v[29])
    abort ();
}

__attribute__((noinline, noclone)) void
foo (long double *x, long y, long z)
{
  long double a, b, c;
  a = x[z * 4 + y * 3];
  b = x[z * 5 + y * 3];
  c = x[z * 5 + y * 4];
  x[y * 4] = a;
  bar (&x[z * 5 + y]);
  x[z * 5 + y * 5] = b + c;
}

int
main ()
{
  foo (v, 24, 1);
  return 0;
}

This fails at -O2, works with -O2 -fno-tree-slsr.  Started with
http://gcc.gnu.org/r190220

The *.reassoc2 to *.slsr diff with unimportant stuff removed:
...
   _2 = z_1(D) * 4;
   _4 = y_3(D) * 3;
   _5 = _2 + _4;
...
   _12 = z_1(D) * 5;
-  _13 = _4 + _12;   
+  _13 = _5 + z_1(D);
...
   _18 = y_3(D) * 4;
-  _19 = _12 + _18; 
+  _19 = _13 + y_3(D);
...
-  _28 = y_3(D) + _12;
+  _28 = _19 - _5;
...

Here before slsr we have:
_5 = y*3+z*4    
_13 = y*3+z*5
_19 = y*4+z*5    
_28 = y+z*5
and the _13 and _19 changes look just fine, but the _28 change is changing the
value from y+z*5 to y+z.


             reply	other threads:[~2013-04-15  8:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15  8:25 jakub at gcc dot gnu.org [this message]
2013-04-15  8:25 ` [Bug tree-optimization/56962] " jakub at gcc dot gnu.org
2013-04-15 10:15 ` jakub at gcc dot gnu.org
2013-04-15 13:19 ` wschmidt at gcc dot gnu.org
2013-04-15 15:02 ` jakub 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-56962-4@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).