From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12973 invoked by alias); 17 Oct 2012 23:49:06 -0000 Received: (qmail 12941 invoked by uid 48); 17 Oct 2012 23:48:53 -0000 From: "kkojima at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/54963] New: Wrong code generated for libgfortran/generated/eoshift3_8.c on SH Date: Wed, 17 Oct 2012 23:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: kkojima 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 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 X-SW-Source: 2012-10/txt/msg01609.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54963 Bug #: 54963 Summary: Wrong code generated for libgfortran/generated/eoshift3_8.c on SH Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: middle-end AssignedTo: unassigned@gcc.gnu.org ReportedBy: kkojima@gcc.gnu.org Target: sh*-*-* Created attachment 28469 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28469 A test case Several fortran tests using some eoshift functions fail on sh4-unknown-linux-gnu for a while. The above test case is a reduced one which fails sh-elf with -O2 -ml -m4. The right result would be "adhbeh..." but it wrongly returns "ticzzz...". It seems that the compiler allocates a stack slot at r15+60 for "len" variable first for the line 126: len = ((array)->dim[dim]._ubound + 1 - (array)->dim[dim].lower_bound); then computes len - abs (sh) for the line 184; for (n = 0; n < len - delta; n++) using "len" variable at r15+68. The error went away with -fno-ira-share-spill-slots.