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

Andrew Haley <aph at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |aph at gcc dot gnu.org

--- Comment #2 from Andrew Haley <aph at gcc dot gnu.org> 2011-10-18 10:20:40 
UTC ---
This is definitely a C front-end bug.  If you look at the gimple dump, you can
see that the literal 268517138.f isn't being correctly truncated, but instead
the constant 2.68517138e+8 is being used instead:

main (int argc, char * * argv)
{
  double D.2549;
  const char * restrict D.2550;
  double D.2551;
  const char * restrict D.2552;
  int D.2553;
  float a;

  a = 2.68517152e+8;
  D.2549 = (double) a;
  D.2550 = (const char * restrict) &" 268517138.f = %f\t%f\n"[0];
  printf (D.2550, 2.68517138e+8, D.2549);

C++ FE does it correctly:

int main(int, char**) (int argc, char * * argv)
{
  double D.2226;
  double D.2227;
  double D.2228;
  double D.2229;
  int D.2230;

  {
    float a;

    a = 2.68517152e+8;
    D.2226 = (double) a;
    D.2227 = (double) 2.68517152e+8;
    printf (&" 268517138.f = %f\t%f\n"[0], D.2227, D.2226);

Reply via email to