public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/35885]  New: unsinged long long and while loop evaluation regression?
@ 2008-04-09 10:33 wilbert at jdg dot info
  2008-04-09 13:06 ` [Bug c/35885] unsigned " rguenth at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: wilbert at jdg dot info @ 2008-04-09 10:33 UTC (permalink / raw)
  To: gcc-bugs

The following program:
#include <stdio.h>

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


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

end of thread, other threads:[~2009-04-01  8:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-09 10:33 [Bug c/35885] New: unsinged long long and while loop evaluation regression? wilbert at jdg dot info
2008-04-09 13:06 ` [Bug c/35885] unsigned " rguenth at gcc dot gnu dot org
2008-04-09 15:37 ` wilbert at jdg dot info
2008-04-12  0:46 ` wilson at tuliptree dot org
2008-04-12  3:11 ` [Bug middle-end/35885] " pinskia at gcc dot gnu dot org
2008-04-15  0:26 ` wilson at gcc dot gnu dot org
2009-03-31 16:07 ` [Bug middle-end/35885] [4.3/4.4/4.5 Regression] " jsm28 at gcc dot gnu dot org
2009-04-01  8:19 ` 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).