From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31906 invoked by alias); 9 Apr 2008 10:33:12 -0000 Received: (qmail 31291 invoked by uid 48); 9 Apr 2008 10:32:27 -0000 Date: Wed, 09 Apr 2008 10:33:00 -0000 Subject: [Bug c/35885] New: unsinged long long and while loop evaluation regression? X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "wilbert at jdg dot info" 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: 2008-04/txt/msg00689.txt.bz2 The following program: #include int main(int argc, char **argv) { unsigned int testu32a = 0x506f85f; unsigned long long testu64a = 0x9afa246709018f48ULL; printf("before: testu64a = %08x%08x, testu32a = %08x\n", (unsigned int)( testu64a >> 32 ), (unsigned int)( testu64a & 0xffffffff ), testu32a ); while ((unsigned long long)testu32a * (unsigned long long)0xffffffff < testu64a) testu64a /= 2; printf("after: testu64a = %08x%08x, testu32a = %08x\n", (unsigned int)( testu64a >> 32 ), (unsigned int)( testu64a & 0xffffffff ), testu32a ); return 0; } When compiled under freebsd 6 using "gcc -o test test.c" gives different results when using gcc 3.4.4 or gcc 4.2.4: Using 3.4.4: before: testu64a = 9afa246709018f48, testu32a = 0506f85f after: testu64a = 04d7d12338480c7a, testu32a = 0506f85f Using 4.2.4: before: testu64a = 9afa246709018f48, testu32a = 0506f85f after: testu64a = 9afa246709018f48, testu32a = 0506f85f The behavior of 4.2.4 has also been seen on a linux gentoo machine running gcc 4.1.2, a 64bit xp machine running gcc 4.2.1, and a regular xp machine running gcc 4.2.1. -- Summary: unsinged long long and while loop evaluation regression? Product: gcc Version: 4.2.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: wilbert at jdg dot info GCC build triplet: several GCC host triplet: several GCC target triplet: several http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35885