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/77436] Incorrect constant result for summing loop inserted


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77436

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2016-08-31
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Now the following program does not have any overflow in it (only wrapping) and
still causes wrong code:
int main(int argc, char *argv[]) {
  unsigned sum = 0;
  for (int x = -(0x7fffffff -1); x <= (0x7fffffff -1); x++)


    sum += x;
  printf("%08x\n", sum);
  return 0;
}

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