public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/56962] New: [4.8/4.9 Regression] SLSR caused miscompilation of fftw
@ 2013-04-15  8:25 jakub at gcc dot gnu.org
  2013-04-15  8:25 ` [Bug tree-optimization/56962] " jakub at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-04-15  8:25 UTC (permalink / raw)
  To: gcc-bugs


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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-15 15:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-15  8:25 [Bug tree-optimization/56962] New: [4.8/4.9 Regression] SLSR caused miscompilation of fftw jakub at gcc dot gnu.org
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

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).