From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27506 invoked by alias); 7 Sep 2006 04:58:53 -0000 Received: (qmail 27474 invoked by uid 48); 7 Sep 2006 04:58:45 -0000 Date: Thu, 07 Sep 2006 04:58:00 -0000 Subject: [Bug middle-end/28970] New: Wrong code for simple loop test case X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "bergner at vnet dot ibm dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-09/txt/msg00498.txt.bz2 List-Id: 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 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