public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/39794]  New: Miscompile with -O2 -funroll-loops
@ 2009-04-17  9:58 abel at gcc dot gnu dot org
  2009-04-17 10:27 ` [Bug middle-end/39794] [4.4/4.5 Regression] " amonakov at gcc dot gnu dot org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: abel at gcc dot gnu dot org @ 2009-04-17  9:58 UTC (permalink / raw)
  To: gcc-bugs

The following testcase aborts with -O2 -funroll-loops, but passes with plain
-O2 for me on today's trunk.

--cut here
extern void abort();

void foo(int *a, int n)
{
  int i;
  for (i = 0; i < n; i++)
    {
      a[i] *= 2;
      a[i+1] = a[i-1] + a[i-2];
    }
}

enum {N = 16};
int a[N];
int ref[N] = {0, 1, 4, 2, 10, 12, 24, 44, 72, 136, 232, 416, 736, 1296, 2304,
2032};

int main()
{
  int i;
  for (i = 0; i < N; i++)
    a[i] = i;
  foo(a + 2, N - 3);
  for (i = 0; i < N; i++)
    if (ref[i] != a[i])
      abort();
  return 0;
}

-- cut here


-- 
           Summary: Miscompile with -O2 -funroll-loops
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: abel at gcc dot gnu dot org
GCC target triplet: x86_64-unknown-linux-gnu


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


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

end of thread, other threads:[~2009-04-27 12:49 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-17  9:58 [Bug middle-end/39794] New: Miscompile with -O2 -funroll-loops abel at gcc dot gnu dot org
2009-04-17 10:27 ` [Bug middle-end/39794] [4.4/4.5 Regression] " amonakov at gcc dot gnu dot org
2009-04-17 10:35 ` rguenth at gcc dot gnu dot org
2009-04-17 11:43 ` jakub at gcc dot gnu dot org
2009-04-17 12:19 ` rguenth at gcc dot gnu dot org
2009-04-17 21:55 ` amonakov at gcc dot gnu dot org
2009-04-17 22:06 ` rguenth at gcc dot gnu dot org
2009-04-20 15:48 ` bonzini at gnu dot org
2009-04-20 17:46 ` jakub at gcc dot gnu dot org
2009-04-21 16:02 ` jakub at gcc dot gnu dot org
2009-04-21 17:23 ` jakub at gcc dot gnu dot org
2009-04-22 13:41 ` rguenth at gcc dot gnu dot org
2009-04-22 16:55 ` alexey dot zaytsev at gmail dot com
2009-04-22 16:58 ` alexey dot zaytsev at gmail dot com
2009-04-23 14:37 ` bonzini at gnu dot org
2009-04-24  6:58 ` [Bug rtl-optimization/39794] " jakub at gcc dot gnu dot org
2009-04-27 11:55 ` jakub at gcc dot gnu dot org
2009-04-27 12:49 ` jakub at gcc dot gnu dot 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).