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: unassig...@gcc.gnu.org ReportedBy: kkoj...@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.