This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/45559] New: [4.4 regression] wrong conversion from unsigned int/long to float
- From: "zimmerma+gcc at loria dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Sep 2010 15:38:42 -0000
- Subject: [Bug c/45559] New: [4.4 regression] wrong conversion from unsigned int/long to float
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
With the following program:
#include <stdio.h>
int
main()
{
unsigned int t = 254733465;
float f;
f = (float) t;
printf ("t=%u f=%.0f\n", t, f);
}
I get with gcc 4.3 the expected result:
t=254733465 f=254733472
but with gcc 4.4.5:
t=254733465 f=482062944
which is clearly wrong.
Note: this was obtained on smetana.debian.org with
gcc 4.4.5 20100824 (prerelease) (Debian 4.4.4-11)
Note 2: this bug makes GMP-ECM fail:
https://buildd.debian.org/fetch.cgi?pkg=gmp-ecm&arch=sparc&ver=6.3-2&stamp=1281775571&file=log&as=raw
--
Summary: [4.4 regression] wrong conversion from unsigned int/long
to float
Product: gcc
Version: 4.4.5
Status: UNCONFIRMED
Severity: critical
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: zimmerma+gcc at loria dot fr
GCC build triplet: sparc-linux-gnu
GCC host triplet: sparc-linux-gnu
GCC target triplet: sparc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45559