unsigned int in float assignment

Trent Waddington trent@codeplay.com
Tue Apr 2 11:52:00 GMT 2002


Can anyone tell me why the following code breaks?

// run with 1 parameter to fail.
main(int argc, char **argv)
{
   short g;
   unsigned int r = 0;
   float u;

   if (argc == 1) {
      u = 0 - 53;
   } else {
      u = r - 53;
   }
   g = 84 + u;

   if (g == 31) printf("PASS\n");
   else printf("FAIL %i\n", g);
}

Trent Waddington




More information about the Gcc-bugs mailing list