From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26445 invoked by alias); 15 Apr 2013 08:25:10 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 26398 invoked by uid 48); 15 Apr 2013 08:25:07 -0000 From: "jakub at gcc dot 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 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: jakub 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: 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/msg01436.txt.bz2 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.