public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/28970]  New: Wrong code for simple loop test case
@ 2006-09-07  4:58 bergner at vnet dot ibm dot com
  2006-09-07  5:01 ` [Bug middle-end/28970] [4.1 Regression] " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: bergner at vnet dot ibm dot com @ 2006-09-07  4:58 UTC (permalink / raw)
  To: gcc-bugs

We generate bad code for the following test case using the latest 4.1 compiler.
 It compiles and runs fine using 4.2.  It also compiles and runs fine with my
3.3.3 system compiler.  I've tested this on both x86_64 and ppc64 systems, and
the test case fails for both when compiled as a 32-bit app and passes when
compiled as a 64-bit app.

#include <stdio.h>

int tar (int i)
{
  printf("expected = %d, actual = %d\n", 36863, i);
  return -1;
}

void bug(int q, int bcount)
{
  int j = 0;
  int outgo = 0;

  while(j != -1)
    {
      outgo++;
      if (outgo > q-1)
        outgo = q-1;
      j = tar (outgo*bcount);
    }
}

int main(void)
{
  bug(5, 36863);
  return 0;
}

bergner@vervain:~> gcc-4.1.2 -O2 bug01.c
bergner@vervain:~> ./a.out
expected = 36863, actual = 184315


-- 
           Summary: Wrong code for simple loop test case
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bergner at vnet dot ibm dot com
 GCC build triplet: powerpc64-linux
  GCC host triplet: powerpc64-linux
GCC target triplet: powerpc64-linux


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


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

end of thread, other threads:[~2006-11-01 12:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-07  4:58 [Bug middle-end/28970] New: Wrong code for simple loop test case bergner at vnet dot ibm dot com
2006-09-07  5:01 ` [Bug middle-end/28970] [4.1 Regression] " pinskia at gcc dot gnu dot org
2006-09-07 20:26 ` janis at gcc dot gnu dot org
2006-10-16 12:07 ` rguenth at gcc dot gnu dot org
2006-10-27  9:50 ` rguenth at gcc dot gnu dot org
2006-10-27 16:40 ` janis at gcc dot gnu dot org
2006-10-28 11:06 ` rguenth at gcc dot gnu dot org
2006-10-29 23:06 ` [Bug rtl-optimization/28970] " ebotcazou at gcc dot gnu dot org
2006-10-29 23:07 ` ebotcazou at gcc dot gnu dot org
2006-10-30 16:01 ` [Bug rtl-optimization/28970] [4.1 regression] wrong " ebotcazou at gcc dot gnu dot org
2006-11-01 12:11 ` ebotcazou at gcc dot gnu dot org
2006-11-01 12:16 ` ebotcazou 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).