The following program prints "foobar" 10 times:

#include <stdio.h>

unsigned int x = -10;

int main()
{
  for (;;)
    if (x == -1)
      break;
    else {
      printf("foobar\n");
      x++;
    }
  return 0;
}

However, when replacing "unsigned int x" by "unsigned char x" or "unsigned
short x", it prints "foobar" indefinitely. When using a bigger type (such as
"long long"), it prints it 10 times again.


-- 
           Summary: Inconsistency in test
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sam at rfc1149 dot net
  GCC host triplet: i686-pc-linux-gnu


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

Reply via email to