[Bug c/35885] New: unsinged long long and while loop evaluation regression?

2008-04-09 Thread wilbert at jdg dot info
The following program:
#include stdio.h

int main(int argc, char **argv) {
unsigned inttestu32a = 0x506f85f;
unsigned long long  testu64a = 0x9afa246709018f48ULL;

printf(before: testu64a = %08x%08x, testu32a = %08x\n, (unsigned
int)( testu64a  32 ), (unsigned int)( testu64a  0x ), testu32a );

while ((unsigned long long)testu32a * (unsigned long long)0x 
testu64a)
testu64a /= 2;

printf(after: testu64a = %08x%08x, testu32a = %08x\n, (unsigned int)(
testu64a  32 ), (unsigned int)( testu64a  0x ), 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



[Bug c/35885] unsigned long long and while loop evaluation regression?

2008-04-09 Thread wilbert at jdg dot info


--- Comment #2 from wilbert at jdg dot info  2008-04-09 15:36 ---
I just did a fresh build of gcc 4.1.3 from the ports collection under freebsd
6.1

And got this (incorrect) result again:
before: testu64a = 9afa246709018f48, testu32a = 0506f85f
after: testu64a = 9afa246709018f48, testu32a = 0506f85f


-- 


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