This is the mail archive of the gcc@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]

Loop overflow



Can anyone tell me how many iterations this loop should perform on a
32 bit machine?  I cannot find my copy of the C standard and am
wondering if this is allowed to be implementation specific due to
possible overflow.  loop_iterations considers this to be an immediate
loop which I don't think is correct.

int
f()
{
  int j = 1;
  long i;
  for (i = 0x7ffffff0L; i <= 0x7fffffffL; i += 1) j++;
  return j;
}

Michael.


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