This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/45559] New: [4.4 regression] wrong conversion from unsigned int/long to float


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]