public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "wilbert at jdg dot info" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/35885]  New: unsinged long long and while loop evaluation regression?
Date: Wed, 09 Apr 2008 10:33:00 -0000	[thread overview]
Message-ID: <bug-35885-16037@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2008-04-09 10:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-09 10:33 wilbert at jdg dot info [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-35885-16037@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).