With the following program:

#include <stdio.h>

  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:

           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


Reply via email to